home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 November / EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso / earcd / misc / sexehead.lha / SEXeHeader.asm < prev    next >
Assembly Source File  |  1995-09-24  |  97KB  |  2,804 lines

  1. ** EXEHeader.asm    22/9/95
  2. **
  3. **            © 1995  Soyeb Aswat and NKH Software
  4. **
  5. **                Freeware
  6. **
  7. *******************************************************************************************************
  8. *
  9. *  Microsoft Windows New Executable 'NE' Examination utility
  10. *
  11. *******************************************************************************************************
  12. **
  13. ** Open dos.library
  14. ** If open failed then
  15. **   Print error message
  16. **   Return
  17. ** Open file
  18. ** If open failed then
  19. **   Print error message
  20. **   Close dos.library
  21. **   Return
  22. ** Seek to $18
  23. **
  24. ** If (Current file pos word) < $40 then  ; Test if windows prog
  25. **   Close file
  26. **   Close dos.library
  27. **   Return
  28. **
  29. ** Seek to $3C          ; Goto start of win header
  30. ** Get word value
  31. ** Seek to word value above
  32. **
  33. ** If (Current file pos word) <> 'NE' then ; Test if windows NE file
  34. **   Close file
  35. **   Close dos.library
  36. **   Return
  37. **
  38. **  ;   Header length HeaderLen=(offset $20)+(Offset $20)-(WinHead)
  39. **  ; WinHead=Start of windows header
  40. ** Allocate HeaderLen memory     ; Read in header
  41. ** Seek to WinHead
  42. ** Read HeaderLen bytes into buffer
  43. **
  44. ** Print module name
  45. **   Get address of resident-name table
  46. **   Print first entry
  47. ** Print module description
  48. **   Get address of non-resident name table
  49. **   Print first entry
  50. ** Print linker version number (HEX)
  51. ** Print linker revision number (HEX)
  52. ** Print $0C flags data
  53. **   Get word at $0C
  54. **   If bit 0 set then SINGLE DATA
  55. **   If bit 1 set then MULTIPLEDATA
  56. **     else NOAUTODATA
  57. **   If bit 11 set then self loading executable
  58. **   If bit 15 set then file is a library module
  59. ** Print automatic data segment number
  60. **   If 0 then print NOAUTODATA
  61. **     else print segment number
  62. ** Print local heap size
  63. **   If 0 then print No local allocation
  64. **     else print heap size
  65. ** Print initial stack size
  66. ** Print CS:IP
  67. ** Print SS:SP
  68. **   If SP=0 and DS=SS then SP= stacksize + data segment size (data seg size is in seg table)
  69. **     else print SS:SP as normal
  70. **
  71. ** Print offset to start of segment table
  72. ** Print number of entries in segment table
  73. ** Print contents of segment table
  74. **   n=number of entries in segment table
  75. **   REPEAT
  76. **     Print segment number
  77. **     Check offset 0 of each entry and
  78. **     If 0 then print "No data provided for this segment"
  79. **       else print size of segment in file
  80. **     Print minimum allocation for this segment offset 6
  81. **     Print flag meanings
  82. **     Print "Segment type"
  83. **     If bit 0 set then print DATA
  84. **       else print CODE
  85. **     If bit 1 set then print "Loader allocates memory for segment"
  86. **     If bit 2 set then print "Segment is loaded at load time"
  87. **     Print "Segment relocation"
  88. **     If bit 4 set then print "MOVEABLE"
  89. **       else print "FIXED"
  90. **     Print "Segment sharing"
  91. **     If bit 5 set then print "PURE or SHAREABLE"
  92. **       else print "IMPURE or NONSHAREABLE"
  93. **     Print "Segment load type"
  94. **     If bit 6 set then print "PRELOAD"
  95. **       else print "LOADONCALL"
  96. **     If bit 7 set then
  97. **       Print "Access type"
  98. **       If bit 0 set then print "READONLY"
  99. **         else print "EXECUTEONLY"
  100. **     If bit 8 set then print "Segment contains relocation data"
  101. **     If bit 12 set then print "Segment is discardable"
  102. **     Decrement n
  103. **     UNTIL n=0
  104. **
  105. ** Print offset to resource table
  106. ** Print contents of resource table
  107. **   Print rscAlignShift
  108. **   Print rscTypes
  109. **     REPEAT
  110. **     Print rtTypeID
  111. **       If rtTypeID < $8000 then 
  112. **         n=( rtTypeID + resource table base )
  113. **         Print n chars from above address+1
  114. **       If rtTypeID = $8000 + 1  then print "RT_CURSOR"
  115. **       If rtTypeID = $8000 + 2  then print "RT_BITMAP"
  116. **       If rtTypeID = $8000 + 3  then print "RT_ICON"
  117. **       If rtTypeID = $8000 + 4  then print "RT_MENU"
  118. **       If rtTypeID = $8000 + 5  then print "RT_DIALOG"
  119. **       If rtTypeID = $8000 + 6  then print "RT_STRING"
  120. **       If rtTypeID = $8000 + 7  then print "RT_FONTDIR"
  121. **       If rtTypeID = $8000 + 8  then print "RT_FONT"
  122. **       If rtTypeID = $8000 + 9  then print "RT_ACCELERATOR"
  123. **       If rtTypeID = $8000 + 10 then print "RT_RCDATA"
  124. **       If rtTypeID = $8000 + 12 then print "RT_GROUP_CURSOR"
  125. **       If rtTypeID = $8000 + 14 then print "RT_GROUP_ICON"
  126. **       If rtTypeID = $8000 + 16 then print "Version info?"
  127. **       ELSE Print "Unknown resource type",rtTypeID
  128. **     Print rtResourceCount
  129. **     Skip rtReserved (word)
  130. **     FOR n=1 to rtResourceCount
  131. **       Print rtNameInfo
  132. **         Print rnOffset
  133. **         Print rnLength
  134. **         Print rnFlags
  135. **           If bit 4 set then print "MOVEABLE"
  136. **           If bit 5 set then print "PURE"
  137. **           If bit 6 set then print "PRELOAD"
  138. **         Print rnID
  139. **           If rnID >= $8000 then print rnID-$8000
  140. **           ELSE
  141. **         n=( rnID + resource table base )
  142. **             Print n chars from above address+1
  143. **         Skip rnHandle (word)
  144. **         Skip rnUsage (word)
  145. **       END ; FOR
  146. **     UNTIL rscEndTypes ; ie. next byte = 0 ; REPEAT for printing rscTypes
  147. **
  148. ** Print resident-name table
  149. **   Get address of resident-name table
  150. **   Skip first entry
  151. **     Get length of string
  152. **     Add to pointer
  153. **     Add 2 to pointer to skip ordinal
  154. **   WHILE next byte !=
  155. **     Get length of string
  156. **     Skip pointer past string
  157. **     Print string
  158. **     Print ordinal
  159. **     END ; WHILE
  160. **
  161. ** Print module-reference and imported-name tables
  162. **   Print number of entries in module-reference table
  163. **   Get address of imported-name table
  164. **   FOR n=1 to number of entries in module-reference table
  165. **     Get length of string
  166. **     Get address of string
  167. **     Print string
  168. **     END ; FOR
  169. **
  170. ** Print entry table
  171. **   Test length of entry table
  172. **   If length != 0 then
  173. **     Get address of entry table
  174. **     REPEAT
  175. **     Get number of entries in bundle
  176. **     Get bundle type
  177. **     Add 2 to pointer
  178. **     If bundle type = 0 then        ; Null entry
  179. **       Print "Null entries : ",entries
  180. **       Add entries to entry counter.
  181. **     If bundle type = $FE then        ; Constant pointer
  182. **       Print "Constant pointer"
  183. **       FOR n=1 to entries in bundle
  184. **         Print "Entry ",entry counter
  185. **         Print "Offset  :  ",EntryConstValue
  186. **         If bit 0 of EntryFixFlags = 1 then
  187. **           Print " Exported "
  188. **         If bit 1 of EntryFixFlags = 1 then
  189. **           Print "SINGLEDATA"
  190. **         Add 3 to pointer
  191. **         END ; FOR
  192. **     If bundle type = $FF then        ; Movable segment
  193. **       Print "Movable segment records : ",entries in bundle," entries."
  194. **       FOR n=1 to entries in bundle
  195. **         Print "Entry ",entry counter
  196. **         Print "Segment : ",EntryMoveSegment
  197. **         Print "Offset  : ",EntryMoveOffset
  198. **         If bit 0 of EntryMoveFlags = 1 then
  199. **           Print " Exported "
  200. **         If bit 1 of EntryMoveFlags = 1 then
  201. **           Print " Global"
  202. **         Add 6 to pointer
  203. **         END ; FOR
  204. **     ELSE                    ; Fixed segment
  205. **       Print "Fixed segment records : ",entries in bundle," entries.    Segment : ",bundle type
  206. **       FOR n=1 to entries in bundle
  207. **         Print "Entry ",entry counter
  208. **         Print "Offset  : ",EntryFixOffset
  209. **         If bit 0 of EntryFixFlags = 1 then
  210. **           Print " Exported "
  211. **         If bit 1 of EntryFixFlags = 1 then
  212. **           Print "SINGLEDATA"
  213. **         Add 3 to pointer
  214. **         END ; FOR
  215. **     UNTIL next byte = 0
  216. **
  217. ** Print segment relocations
  218. **   Print "Segment relocations"
  219. **   Initialize segment counter
  220. **   Get address of segment table
  221. **   Get number of entries in segment table
  222. **   FOR n = 1 to entries in segment table
  223. **     If this segment contains relocation data then
  224. **     Print "Relocations for segment ",segment counter
  225. **     Goto position of segment in file
  226. **     Move an extra segment length bytes
  227. **     Get intel word at that address (items in table)
  228. **     Allocate items in table * 8 bytes of ram
  229. **     If allocation UNsuccesful then
  230. **       Print "Out of memory"
  231. **       rts
  232. **     Read items in table * 8 bytes into allocated buffer
  233. **     If read failed then
  234. **       Print "Read from file failed!"
  235. **       rts
  236. **     Print "type    offset       target"
  237. **     FOR x = 1 to items in table
  238. **       If RelocAddrType = 0 then
  239. **         Print "LoByte  "
  240. **       If RelocAddrType = 2 then
  241. **         Print "Select  "
  242. **       If RelocAddrType = 3 then
  243. **         Print "PTR     "
  244. **       If RelocAddrType = 5 then
  245. **         Print "OFFS    "
  246. **       If RelocAddrType = 11 then
  247. **         Print "PTR-48  "
  248. **       If RelocAddrType = 13 then
  249. **         Print "OFFS-32 "
  250. **       else print "Unknown relocation type. Send me this file to df114@city.ac.uk read docs!!!!"
  251. **         rts
  252. **
  253. **       Print RelocOffset
  254. **       If RelocType = 0 then        ; Internal reference
  255. **         If RelocB4 = $FF then
  256. **           Print "Entry ",RelocB6
  257. **         else
  258. **           Print RelocB4,":",RelocB6        ; Segment:Offset are the wrong way round!
  259. **       If RelocType = 1 then        ; Imported ordinal
  260. **         (RelocB4 - 1)*2
  261. **         Add offset to mod-ref table
  262. **         Add that word to offset of imp-name table
  263. **         Print that byte many bytes at that addr+1
  264. **         Print ".",RelocB6
  265. **       If RelocType = 2 then        ; Imported name
  266. **         (RelocB4 - 1)*2
  267. **         Add offset to mod-ref table
  268. **         Add that word to offset of imp-name table
  269. **         Print that byte many bytes at that addr+1
  270. **         Print "."
  271. **         RelocB6 + offset to imp-name table
  272. **         Print that byte many bytes at that addr+1
  273. **       If RelocType = 3 then        ; OSFIXUP
  274. **         Print "OSFIXUP Send me this file to df114@city.ac.uk read docs!!!!"
  275. **         rts
  276. **       If RelocType = 5 then        ; Additive?
  277. **         (RelocB4 - 1)*2
  278. **         Add offset to mod-ref table
  279. **         Add that word to offset of imp-name table
  280. **         Print that byte many bytes at that addr+1
  281. **         Print ".",RelocB6
  282. **       else
  283. **         Print "Unknown relocation type send me this file to df114@city.ac.uk read docs!!!!"
  284. **
  285. **       Add 8 to pointer            ; Skip to next entry in relocation table
  286. **       END ; FOR
  287. **     Deallocate memory just used
  288. **     Add 8 to pointer'            ; Skip to next entry in segment table
  289. **     END ; FOR
  290.  
  291. ** Close file
  292. ** Close dos.library
  293. ** Return
  294.  
  295.         INCLUDE     work:languages/devpac/system
  296. ;        INCLUDE  "work:languages/devpac/amiga.lib.inc"
  297. ;        INCLUDE  "exec/exec.i"
  298. ;        INCLUDE  "dos/dos.i"
  299. ;        INCLUDE     "work:languages/devpac/examples/misc/easystart.i"
  300.  
  301. ;        XREF     _LVOReadArgs()
  302.  
  303. AbsExecBase    EQU    4
  304. AnyMemoryType    EQU    0
  305. NewLine        EQU    10
  306. NULL        EQU    0
  307.  
  308. ** Locations in the file
  309.  
  310. AutoDataSegNum        EQU    $0E
  311. DataOffset        EQU    $00
  312. DosHeaderValid        EQU    $18
  313. EntryBndlNum        EQU    $00    ; Entry table    Number of entries in this bundle
  314. EntryBndlTyp        EQU    $01    ;        Bundle type
  315. EntryConstFlags        EQU    $00    ;        Offset to flags for entry type constant
  316. EntryConstValue        EQU    $01    ;        Offset to value for entry type constant
  317. EntryFixFlags        EQU    $00    ;        Flags for fixed segment
  318. EntryFixOffset        EQU    $01    ;        Offset for fixed segment
  319. EntryLength        EQU    $06    ;    Length of entry table in entries (in windows header)
  320. EntryMoveFlags        EQU    $00    ;        Flags for movable segment
  321. EntryMoveOffset        EQU    $04    ;        Offset for movable segment
  322. EntryMoveSeg        EQU    $03    ;        Segment number for movable segment
  323. EntryOffset        EQU    $04    ;    Offset to entry table relative to start of windows header
  324. FileFlags        EQU    $0C
  325. FileSegLength        EQU    $02
  326. ImpTableOffset        EQU    $2A
  327. ImpNameOffset        EQU    $2A
  328. InitCSIP        EQU    $14
  329. InitLocalHeap        EQU    $10
  330. InitSSSP        EQU    $18
  331. InitStackSize        EQU    $12
  332. LinkerRevisionNum    EQU    $02
  333. LinkerVersionNum    EQU    $03
  334. ModRefOffset        EQU    $28
  335. ModTableEntries        EQU    $1E
  336. NonResNamTabOffset    EQU    $2C
  337. NonResNamTableSize    EQU    $20
  338. rnFlags            EQU    $04
  339. rnID            EQU    $06
  340. rnLength        EQU    $02
  341. rnOffset        EQU    $00
  342. rscAlignShift        EQU    $00
  343. RelocAddrType        EQU    $00
  344. RelocB4            EQU    $04
  345. RelocB6            EQU    $06
  346. RelocOffset        EQU    $02
  347. RelocType        EQU    $01
  348. ResNameTabOffset    EQU    $26
  349. RscTableOffset        EQU    $24
  350. SegAllocSize        EQU    $06
  351. SegFlags        EQU    $04
  352. SegmentPos        EQU    $00
  353. SegmentLen        EQU    $02
  354. SegTableEntryNum    EQU    $1C
  355. SegTableOffset        EQU    $22
  356. ShiftCount        EQU    $32
  357. WinHeaderOffset        EQU    $3C
  358.  
  359.  
  360.  
  361. ** Temporary storage
  362.  
  363. TempStoreSize    EQU    256        ; Size of the temporary storage buffer
  364.  
  365. DosBase        EQU    4*0
  366. aFileHandle    EQU    4*1
  367. HeaderAddress    EQU    4*2
  368. HeaderLen    EQU    4*3
  369. HeaderOffset    EQU    4*4
  370. OutputHandle    EQU    4*5
  371. RelocBufferAddr    EQU    4*6
  372. RelocBufferLen    EQU    4*7
  373. StackEquation    EQU    4*8
  374. TempBufferLen    EQU    4*9
  375. UseStdIOFlag    EQU    4*10
  376. TempBuffer    EQU    4*11        ; *MUST* always be last!
  377.  
  378.  
  379.  
  380.  
  381.         SECTION  code,CODE
  382.  
  383. ; Allocate temporary storage buffer
  384.  
  385.     move.l    AbsExecBase,a6        ; Get exec base address
  386.  
  387.     move.l    #0,d0            ; Clear
  388.     move.l    #$FFFFFFFF,d1        ; All
  389.     jsr    _LVOSetSignal(a6)    ; Signals
  390.  
  391.     move.l    #TempStoreSize,d0    ; Allocate Temp store bytes of ram
  392.     move.l    d0,d3            ; Save buffer length
  393.     move.l    #AnyMemoryType,d1    ; Any type of memory
  394.     jsr    _LVOAllocMem(a6)    ; Allocate the memory
  395.     tst.l    d0            ; Was memory allocated?
  396.     beq    TempBufNoAlloc        ; Temp buffer was not allocated
  397.     move.l    d0,a5            ; Store address in a5
  398.  
  399.     move.l    d3,TempBufferLen(a5)    ; Save length of temp buffer
  400.  
  401. ; Open dos.library
  402.  
  403.     move.l    #37,d0            ; d0 = version 37 or above
  404.     lea    DosLibName,a1        ; a0 = * "dos.library"
  405.     jsr    _LVOOpenLibrary(a6)    ; Open dos.library
  406.     tst.l    d0            ; Did dos lib open OK?
  407.     beq    DosNotOpen        ; Goto dos lib not opened OK
  408.     move.l    d0,DosBase(a5)        ; Save dos base address
  409.     move.l    d0,a6            ; Put dos base address in a6
  410.     
  411. ; Get standard output handle
  412.  
  413.     move.l    #$FFFFFFFF,UseStdIOFlag(a5)    ; Clear flag
  414.     jsr    _LVOOutput(a6)        ; Get standard output handle
  415.     move.l    d0,OutputHandle(a5)    ; Save output handle
  416.  
  417. ; Read command line
  418.  
  419.     lea    Template,a0        ; Get address of template
  420.     move.l    a0,d1            ; Put in template register
  421.  
  422.     lea    TempBuffer(a5),a0    ; Get address of temp buffer
  423.     move.l    a0,d2            ; Put in array register
  424.     clr.l    4(a0)            ; Clear the second argument
  425.     move.l    #NULL,d3        ; Use Input()
  426.  
  427.     jsr    _LVOReadArgs(a6)    ; Read the command line
  428.  
  429.     move.l    d0,d7            ; Save address Args
  430.     move.l    d0,d1            ; Get ready for FreeArgs
  431.  
  432.     tst.l    d1            ; Did it fail?
  433.     bne    DidNotFail        ; Jump if no fail
  434.  
  435.     jsr    _LVOFreeArgs(a6)    ; Free their memory        If ReadArgs failed then quit
  436.     lea    Template,a0        ; Get address of message
  437.     move.l    TemplateLen,d3        ; Get length of message
  438.     bsr    PrintMSG        ; Print message
  439.     lea    NewLineMSG,a0        ; Get address of message
  440.     move.l    NewLineMSGLen,d3    ; Get length of message
  441.     bra    PrintErrorAndReturnToDos; Finished
  442.  
  443. ; Use stdio?
  444.  
  445. DidNotFail
  446.     tst.l    TempBuffer+4(a5)    ; Use stdio?
  447.     bne    UseStdIO        ; Jump if yes
  448.  
  449.     move.l    #0,UseStdIOFlag(a5)    ; Clear stdio flag            Open window for output
  450.     lea    OutputString,a0        ; Get console name
  451.     move.l    a0,d1            ; Put in right register
  452.     move.l    #MODE_READWRITE,d2    ; Get mode
  453.     jsr    _LVOOpen(a6)        ; Open output
  454.     move.l    d0,OutputHandle(a5)    ; Save output handle
  455.  
  456. UseStdIO
  457.  
  458. ; Open file
  459.  
  460.     move.l    TempBuffer(a5),d1    ; Get address of argument
  461.     move.l    #MODE_OLDFILE,d2    ; Open file for reading
  462.     jsr    _LVOOpen(a6)        ; Open file
  463.  
  464.     move.l    d7,d1            ; Get Args structure
  465.     move.l    d0,d7            ; Save file handle
  466.     jsr    _LVOFreeArgs(a6)    ; Free their memory
  467.  
  468.     move.l    d7,d0            ; Get file handle
  469.     tst.l    d0            ; Did file open OK?
  470.     beq    FileNotOpenOK        ; Goto file not open error
  471.     move.l    d0,aFileHandle(a5)    ; Save open file handle
  472.  
  473. ; Seek to is dos header a valid windows header?
  474.  
  475.     move.l    #DosHeaderValid,d2    ; Position to go to
  476.     bsr    SeekTo            ; Seek
  477.  
  478. ; If (current file position word) < $40 then quit
  479.  
  480.     bsr    ReadIntelWord        ; Read word at position
  481.     cmp.w    #$40,d2            ; Is less than $40?
  482.     blt    NotWindowsEXE        ; Goto wrong file type error
  483.  
  484. ; Seek to offset to windows header
  485.  
  486.     move.l    #WinHeaderOffset,d2    ; Position to go to
  487.     bsr    SeekTo            ; Seek there
  488.  
  489. ; Get word value
  490.  
  491.     bsr    ReadIntelWord        ; Read word at that position
  492.     clr.l    d4            ; Clear scratch register
  493.     move.w    d2,d4            ; d4 = offset to start of header
  494.     move.l    d4,d2            ; Clear high word
  495.     move.l    d2,HeaderOffset(a5)    ; Save offset
  496.  
  497. ; Seek to word value above
  498.  
  499.     bsr    SeekTo            ; Seek to start of header
  500.  
  501. ; If (current file pos word) <> "NE" then quit
  502.  
  503.     bsr    ReadIntelWord        ; Get word at start of header
  504.     cmp.w    #$454E,d2        ; Is it "NE"? The code $454E is "EN"
  505.                     ; because ReadWord reverses the bytes
  506.     bne    NotWindowsEXE        ; Quit if not New Executable
  507.  
  508. ; HeaderLen = (bytes in non-resident name table)+(offset to non-resident name table)-(WinHeaderOffset)
  509.  
  510.     move.l    #NonResNamTableSize,d2    ; Offset $20
  511.     add.l    d4,d2            ; Add base
  512.     bsr    SeekTo            ; Seek to $20
  513.     bsr    ReadIntelWord        ; Read word
  514.     clr.l    d5            ; Clear scratch register
  515.     move.w    d2,d5            ; Move ($20) to d5
  516.     move.l    #NonResNamTabOffset,d2    ; Offset $2C
  517.     add.l    d4,d2            ; Add base
  518.     bsr    SeekTo            ; Seek to $2C
  519.     bsr    ReadIntelWord        ; Read low word at $2C
  520.     move.w    d2,d6            ; Save word
  521.     bsr    ReadIntelWord        ; Read high word at $2C
  522.     swap    d2            ; Place high byte in correct position
  523.     move.w    d6,d2            ; Construct longword
  524.     add.l    d2,d5            ; d5 = (offset $20)+(offset$2C)
  525.     sub.l    d4,d5            ; d5 = ($20)+($2C)-(WinHeaderOffset)
  526.     move.l    d5,HeaderLen(a5)    ; Store HeaderLen
  527.  
  528. ;    bra    CloseFileAndDosLib;testing
  529.  
  530. ; Allocate HeadLen bytes of memory
  531.  
  532.     move.l    d5,d0            ; Put HeadLen into d0
  533.     move.l    #AnyMemoryType,d1    ; Any memory type
  534.     move.l    AbsExecBase,a6        ; Get ExecBase
  535.     jsr    _LVOAllocMem(a6)    ; Allocate the memory
  536.     tst.l    d0            ; Was memory allocated?
  537.     beq    MemoryNotAllocated    ; Goto not enough memory error
  538.     move.l    d0,a4            ; Store address of allocated memory
  539.     move.l    d0,HeaderAddress(a5)    ; Store alloced mem addr permanantly
  540.  
  541. ; Seek to start of win header
  542.  
  543.     move.l    DosBase(a5),a6        ; Get dos lib base address
  544.     move.l    d4,d2            ; Get win header base address
  545.     bsr    SeekTo            ; Goto start of header
  546.  
  547. ; Read above bytes into buffer
  548.  
  549.     move.l    aFileHandle(a5),d1    ; Get file handle
  550.     move.l    a4,d2            ; Put memory block address in d2
  551.     move.l    d5,d3            ; HeadLen bytes to be read
  552.     jsr    _LVORead(a6)        ; Read header into buffer
  553.     cmp.l    d5,d0            ; Was whole header read?
  554.     bne    ReadFailed        ; Goto read failed
  555.  
  556.  
  557. ** Main section (prints everything) *******************************************************************
  558.  
  559.     bsr    PrintFileDetails    ; Prints details about the whole file
  560.  
  561.     bsr    PrintSegmentTable    ; Print the segment table
  562.  
  563.     bsr    PrintResourceTable    ; Well isn't it obvious?    Print resource table
  564.  
  565.     bsr    PrintResNameTable    ; Print resident name table
  566.  
  567.     bsr    PrintModImpTables    ; Print module-reference and imported-name tables
  568.  
  569.     bsr    PrintNonResNameTable    ; Print non-resident name table
  570.  
  571.     bsr    PrintEntryTable        ; Print the entry table
  572.  
  573.     bsr    PrintRelocTabs        ; Print segment relocation tables
  574.  
  575. ******************************************************************************************************
  576.  
  577. ; Clean up before returning to dos
  578.  
  579.     move.l    AbsExecBase,a6        ; Get exec base
  580.     move.l    a6,a4            ; Keep copy of exec base
  581.     move.l    HeaderAddress(a5),a1    ; Get address of header
  582.     move.l    HeaderLen(a5),d0    ; Get headers length
  583.     jsr    _LVOFreeMem(a6)        ; Free memory
  584.  
  585.     lea    FinishMSG,a0        ; Get address of closing message
  586.     move.l    FinishMSGLen,d3        ; Get length of finish message
  587.     bra    CloseFileAndDosLibPrintMSG    ; Print closing message cleanup and return to dos
  588.  
  589.  
  590. *******************************************************************************************************
  591. *******************************************************************************************************
  592. *******************************************************************************************************
  593. *******************************************************************************************************
  594.  
  595. **----------------------------------------
  596. **
  597. ** Print file details
  598. **
  599. **----------------------------------------
  600.  
  601. PrintFileDetails
  602.  
  603.     move.l    #NULL,d0        ; Clear new signal                Test for CTRL_C
  604.     move.l    d0,d1            ; Clear signal mask
  605.     move.l    AbsExecBase,a6        ; Get exec.library base
  606.     jsr    _LVOSetSignal(a6)    ; Get signals
  607.     move.l    DosBase(a5),a6        ; Get dos.library base
  608.     and.l    #SIGBREAKF_CTRL_C,d0    ; Test for CTRL_C
  609.     beq    FilNoEscape        ; Jump if pressed
  610.     rts
  611.  
  612. FilNoEscape
  613.  
  614. ; Print module name                            Print module name
  615.  
  616.     lea    ModuleNameMSG,a0    ; Get address of message
  617.     move.l    ModuleNameMSGLen,d3    ; Get length of message
  618.     bsr    PrintMSG        ; Print the message
  619.     move.w    ResNameTabOffset(a4),d0    ; Get offset to res nam table      Get address of res nam table
  620.     rol.w    #8,d0            ; Position bytes correctly
  621.     lea    (a4,d0.w),a0        ; Get address of entry table
  622.     clr.l    d3            ; Clear length of module name      Print first entry
  623.     move.b    (a0)+,d3        ; Get length of message
  624.     bsr    PrintMSG        ; Print module name
  625.  
  626. ; Print module description                        Print module description
  627.  
  628.     lea    ModuleDescribeMSG,a0    ; Get address of message
  629.     move.l    ModuleDescribeMSGLen,d3    ; Get length of message
  630.     bsr    PrintMSG        ; Print the message
  631.     move.l    NonResNamTabOffset(a4),d0    ; Get offset to non res nam table      Get address of non res nam table
  632.     rol.w    #8,d0            ; Position bytes correctly
  633.     swap    d0            ; Get low word
  634.     rol.w    #8,d0            ; Position bytes correctly
  635.     sub.l    HeaderOffset(a5),d0    ; Get offset to non-res table
  636.     lea    (a4,d0.w),a0        ; Get address of entry table
  637.     clr.l    d3            ; Clear length of module name      Print first entry
  638.     move.b    (a0)+,d3        ; Get length of message
  639.     bsr    PrintMSG        ; Print module name
  640.  
  641. ; Print linker version number
  642.  
  643.     lea    VersionNumMSG,a0    ; Get address of message
  644.     move.l    VersionNumMSGLen,d3    ; Get message length
  645.     bsr    PrintMSG        ; Print message
  646.     
  647.     move.b    LinkerVersionNum(a4),d3    ; Get linker version number
  648.     bsr    ConvertBin2ASCII    ; Convert to ASCII digits
  649.     move.b    #"$",TempBuffer(a5)    ; Put $ for hexadecimal numbe r
  650.     move.b    d0,TempBuffer+1(a5)    ; Store Hi digit for printing
  651.     move.b    d1,TempBuffer+2(a5)    ; Store Lo digit for printing
  652.     move.b    #NewLine,TempBuffer+3(a5)    ; New line
  653.     move.l    #4,d3            ; 4 characters to be printed
  654.     lea    TempBuffer(a5),a0    ; Get address of string
  655.     bsr    PrintMSG        ; Print the MSG
  656.  
  657. ; Print linker revision number
  658.  
  659.     lea    RevisionNumMSG,a0    ; Get address of message
  660.     move.l    RevisionNumMSGLen,d3    ; Get message length
  661.     bsr    PrintMSG        ; Print message
  662.     
  663.     move.b    LinkerRevisionNum(a4),d3; Get linker revision number
  664.     bsr    ConvertBin2ASCII    ; Convert to ASCII digits
  665.     move.b    #"$",TempBuffer(a5)    ; Put $ for hexadecimal number
  666.     move.b    d0,TempBuffer+1(a5)    ; Store Hi digit for printing
  667.     move.b    d1,TempBuffer+2(a5)    ; Store Lo digit for printing
  668.     move.b    #NewLine,TempBuffer+3(a5)    ; New line
  669.     move.l    #4,d3            ; 4 characters to be printed
  670.     lea    TempBuffer(a5),a0    ; Get address of string
  671.     bsr    PrintMSG        ; Print the MSG
  672.  
  673. ; Print $0C flags data
  674.  
  675.     lea    ExecutableTypeMSG,a0    ; Get address of message
  676.     move.l    ExecutableTypeMSGLen,d3    ; Get message length
  677.     bsr    PrintMSG        ; Print message
  678.  
  679.     lea    NormalExecutableMSG,a0    ; Get address of normal executable message
  680.     move.l    NormalExecutableMSGLen,d3    ; Get length of message
  681.     
  682.     btst    #7,FileFlags+1(a4)    ; Test bit 15 of file flags
  683.     beq    NormalExecutable    ; If bit is zero then normal executable
  684.     
  685.     lea    LibraryModuleMSG,a0    ; File is a library module
  686.     move.l    LibraryModuleMSGLen,d3    ; Get length of above message
  687.  
  688. NormalExecutable
  689.     bsr    PrintMSG        ; Print file type message
  690.  
  691.     lea    FileDataModelMSG,a0    ; Get address of message
  692.     move.l    FileDataModelMSGLen,d3    ; Get message length
  693.     bsr    PrintMSG        ; Print message
  694.  
  695.     lea    SingleDataModelMSG,a0    ; Get address of message
  696.     move.l    SingleDataModelMSGLen,d3    ; Get message length
  697.  
  698.     btst    #0,FileFlags(a4)    ; Test bit 0 of $0C
  699.     bne    PrintDataModel        ; If set then file is SINGLEDATA
  700.  
  701.     lea    MultipleDataModelMSG,a0    ; Get address of message
  702.     move.l    MultipleDataModelMSGLen,d3    ; Get message length
  703.  
  704.     btst    #1,FileFlags(a4)    ; Test bit 1 of $0C
  705.     bne    PrintDataModel        ; If set then file is MULTIPLEDATA
  706.     
  707.     lea    NoAutoDataModelMSG,a0    ; Get address of message
  708.     move.l    NoAutoDataModelMSGLen,d3    ; Get message length
  709.  
  710. PrintDataModel
  711.     bsr    PrintMSG        ; Print message
  712.  
  713.     lea    IsSelfLoadingMSG,a0    ; Get address of message
  714.     move.l    IsSelfLoadingMSGLen,d3    ; Get length of message
  715.     bsr    PrintMSG        ; Print the message
  716.  
  717.     lea    NoMSG,a0        ; Get address of message
  718.     move.l    NoMSGLen,d3        ; Get length of message
  719.  
  720.     btst    #3,FileFlags+1(a4)    ; Test if self loading EXE
  721.     beq    NotSelfLoading        ; Jump if not self loading EXE
  722.     lea    YesMSG,a0        ; Else executable is self loading
  723.     move.l    YesMSGLen,d3        ; Get length of message
  724.  
  725. NotSelfLoading
  726.     bsr    PrintMSG        ; Print the message
  727.  
  728. ; Print auto data segment number. If file is NOAUTODATA then print that
  729.  
  730.     lea    AutoDataSegMSG,a0    ; Get address of message
  731.     move.l    AutoDataSegMSGLen,d3    ; Get length of message
  732.     bsr    PrintMSG        ; Print the message
  733.  
  734.     lea    NoAutoDataModelMSG,a0    ; Get address of message
  735.     move.l    NoAutoDataModelMSGLen,d3; Get message length
  736.     btst    #3,FileFlags+1(a4)    ; Test if self loading EXE
  737.     bne    PrintAutoSegNum        ; If it is then print the message
  738.  
  739.     lea    AutoDataSegNum(a4),a3    ; Get pointer to number
  740.     bsr    PrePrintSingleIntelWord    ; Prepare the number
  741.  
  742. PrintAutoSegNum
  743.     bsr    PrintMSG        ; Print the message
  744.  
  745. ; Print initial local heap size, if 0 then print no local allocation
  746.  
  747.     lea    InitLocalHeapMSG,a0    ; Get address of message
  748.     move.l    InitLocalHeapMSGLen,d3    ; Get length of message
  749.     bsr    PrintMSG        ; Print the message
  750.  
  751.     lea    InitLocalHeap(a4),a3    ; Get address of number
  752.     lea    NoLocalHeapMSG,a0    ; Get no Alloc message address
  753.     move.l    NoLocalHeapMSGLen,d3    ; Get message length
  754.     tst.w    (a3)            ; Is there a heap?
  755.     beq    NoLocalHeap        ; If no local heap then print message
  756.  
  757.     bsr    PrePrintSingleIntelWord    ; Prepare heap size for printing
  758.  
  759. NoLocalHeap
  760.     bsr    PrintMSG
  761.     
  762. ; Print initial stack size
  763.  
  764.     lea    InitStackSizeMSG,a0    ; Get address of message
  765.     move.l    InitStackSizeMSGLen,d3    ; Get length of message
  766.     bsr    PrintMSG        ; Print the message
  767.  
  768.     lea    InitStackSize(a4),a3    ; Get address of number
  769.     bsr    PrePrintSingleIntelWord    ; Prepare the stack size for printing
  770.     bsr    PrintMSG        ; Print the stack size
  771.  
  772. ; Print CS:IP
  773.  
  774.     lea    InitCSIPMSG,a0        ; Get address of message
  775.     move.l    InitCSIPMSGLen,d3    ; Get length of message
  776.     bsr    PrintMSG        ; Print the message
  777.  
  778.     lea    InitCSIP(a4),a3        ; Get address of number
  779.     bsr    PrintSegOffset        ; Print CS:IP
  780.  
  781. ; Print SS:SP if SP=0 and SS=DS then SP= stacksize + data segment size
  782.  
  783.     lea    StackAddressMSG,a0    ; Get address of message
  784.     move.l    StackAddressMSGLen,d3    ; Get length of message
  785.     bsr    PrintMSG        ; Print the message
  786.  
  787.     lea    InitSSSP(a4),a3        ; Get address of SS:SP
  788.  
  789. ;        Note the output below and that of MAPWIN etc. does not agree so I have decided to
  790. ;        remove it for the moment. See docs!
  791.  
  792. ;    tst.w    (a3)            ; Is SP=0?
  793. ;    bne    NormalStack        ; If not then print normally
  794. ;    clr.l    d0            ; Clear d0 for later use
  795. ;    move.w    InitSSSP+2(a4),d0    ; Get SS
  796. ;    cmp.w    AutoDataSegNum(a4),d0    ; Is SS=DS?
  797. ;    bne    NormalStack        ; If not then print normally
  798. ;
  799. ;    lea    StackEquation(a5),a3    ; Temporary equation holder
  800. ;    clr.l    d1            ; Clear d1 for later use
  801. ;    move.b    InitSSSP+3(a4),d1    ; Get high byte of SS
  802. ;    move.b    d1,$03(a3)        ; Save SS high for later printing
  803. ;    lsl.w    #8,d1            ; Position high byte correctly
  804. ;    move.b    InitSSSP+2(a4),d1    ; Get low byte of SS
  805. ;    move.b    d1,$02(a3)        ; Save SS low for later printing
  806. ;    subq.w    #1,d1            ; Decrement it
  807. ;    lsl.l    #3,d1            ; Multiply by segment table entry size (8 bytes)
  808. ;    move.b    SegTableOffset+1(a4),d0    ; Get high byte of seg table offset
  809. ;    lsl.w    #8,d0            ; Position high byte correctly
  810. ;    move.b    SegTableOffset(a4),d0    ; Get low byte of seg table offset
  811. ;    add.l    d0,d1            ; Add offset to start of segment table
  812. ;    move.b    SegAllocSize+1(a4,d1),d0; Get high byte of segment allocation size
  813. ;    lsl.w    #8,d0            ; Position high byte correctly
  814. ;    move.b    SegAllocSize(a4,d1),d0    ; Get low byte of segment allocation size
  815. ;    move.b    InitStackSize+1(a4),d1    ; Get high byte of stack size
  816. ;    lsl.w    #8,d1            ; Position high byte correctly
  817. ;    move.b    InitStackSize(a4),d1    ; Get low byte of stack size
  818. ;    add.w    d0,d1            ; d1=SP
  819. ;    move.b    d1,$00(a3)        ; Save low byte of SP
  820. ;    lsr.w    #8,d1            ; Get high byte of SP
  821. ;    move.b    d1,$01(a3)        ; Save high byte of SP
  822. ;
  823. NormalStack
  824.     bsr    PrintSegOffset        ; Print SS:SP
  825.     rts                ; Finish printing file data
  826.  
  827.  
  828. **--------------------------------------------
  829. **
  830. ** Print segment table
  831. **
  832. **--------------------------------------------
  833.  
  834. ; Print offset to start of segment table
  835.  
  836. PrintSegmentTable
  837.  
  838.     move.l    #NULL,d0        ; Clear new signal                Test for CTRL_C
  839.     move.l    d0,d1            ; Clear signal mask
  840.     move.l    AbsExecBase,a6        ; Get exec.library base
  841.     jsr    _LVOSetSignal(a6)    ; Get signals
  842.     move.l    DosBase(a5),a6        ; Get dos.library base
  843.     and.l    #SIGBREAKF_CTRL_C,d0    ; Test for CTRL_C
  844.     beq    SegNoEscapeStart    ; Jump if pressed
  845.     rts
  846.  
  847. SegNoEscapeStart
  848.  
  849.     lea    SegTableOffsetMSG,a0    ; Get address of message        Print offset to start of segment table
  850.     move.l    SegTableOffsetMSGLen,d3    ; Get length of message
  851.     bsr    PrintMSG        ; Print message
  852.  
  853.     lea    SegTableOffset(a4),a3    ; Get address of offset
  854.     bsr    PrePrintSingleIntelWord    ; Prepare number for printing
  855.     bsr    PrintMSG        ; Print the number
  856.  
  857. ; Print number of entries in segment table
  858.  
  859.     lea    SegTableEntryNumMSG,a0    ; Get address of message        Print number of entries in segment table
  860.     move.l    SegTableEntryNumMSGLen,d3    ; Get length of message
  861.     bsr    PrintMSG        ; Print message
  862.  
  863.     lea    SegTableEntryNum(a4),a3    ; Get address of number of entries
  864.     bsr    PrePrintSingleIntelWord    ; Prepare number for printing
  865.     bsr    PrintMSG        ; Print the number
  866.  
  867. ; Print contents of segment table
  868.  
  869.     clr.l    d0            ; Clear d0
  870.     move.w    SegTableOffset(a4),d6    ; Get offset to table            d6=offset to seg table this is for later
  871.     rol.w    #8,d6            ; Position high byte correctly
  872.     bsr    PrePrintSingleIntelWord    ; Prepare number for printing
  873.     move.w    SegTableEntryNum(a4),d7    ; Get number of entries            d7=n this is for the FOR later
  874.     rol.w    #8,d7            ; Position high byte correctly
  875. ;    subq.w    #1,d7            ; Segment number starts with 1
  876.  
  877.     move.w    #1,d5            ; Counter for segment number
  878.     
  879. PrintSegmentTableEntry            ;                    REPEAT
  880.  
  881.     move.l    #NULL,d0        ; Clear new signal                Test for CTRL_C
  882.     move.l    d0,d1            ; Clear signal mask
  883.     move.l    AbsExecBase,a6        ; Get exec.library base
  884.     jsr    _LVOSetSignal(a6)    ; Get signals
  885.     move.l    DosBase(a5),a6        ; Get dos.library base
  886.     and.l    #SIGBREAKF_CTRL_C,d0    ; Test for CTRL_C
  887.     beq    SegNoEscape        ; Jump if pressed
  888.     rts
  889.  
  890. SegNoEscape
  891.     lea    SegmentNumberMSG,a0    ; Get address of message          Print segment number
  892.     move.l    SegmentNumberMSGLen,d3    ; Get length of message
  893.     bsr    PrintMSG        ; Print the message
  894.     move.w    d5,d0            ; d0=segment number for printing
  895.     move.b    d0,StackEquation(a4)    ; Put low byte of seg num for printing
  896.     lsr.w    #8,d0            ; Get high byte
  897.     move.b    d0,StackEquation+1(a4)    ; Put high byte of seg num for printing
  898.     lea    StackEquation(a4),a3    ; Get address of number for printing
  899.     bsr    PrePrintSingleIntelWord    ; Prepare number for printing
  900.     bsr    PrintMSG        ; Print the number
  901.  
  902.     lea    NoDataInSegmentMSG,a0    ; Get address of message          Check offset 0 of each entry and
  903.     move.l    NoDataInSegmentMSGLen,d3; Get length of message
  904.     tst.w    DataOffset(a4,d6)    ; Is there any data?
  905.     beq    NoDataInSegment        ; Print message    if 0                If 0 then print "No data provided for this segment"
  906.  
  907.     lea    FileSegLengthMSG,a0    ; Get address of message              else print size of segment in file
  908.     move.l    FileSegLengthMSGLen,d3    ; Get length of message
  909.     bsr    PrintMSG        ; Print the message
  910.     lea    SixtyFourKMSG,a0    ; Get address of message
  911.     move.l    SixtyFourKMSGLen,d3    ; Get length of message
  912.     lea    FileSegLength(a4,d6),a3    ; Get address of number
  913.     tst.w    (a3)            ; Is it zero? Which means 64k allocated
  914.     beq    NoDataInSegment        ; If 64k size then print that
  915.     bsr    PrePrintSingleIntelWord    ; Prepare file segment length for printing
  916.  
  917. NoDataInSegment
  918.     bsr    PrintMSG        ; Print message
  919.  
  920. MinAllocForSegment
  921.     lea    MinAllocForSegMSG,a0    ; Get address of message          Print minimum allocation for this segment
  922.     move.l    MinAllocForSegMSGLen,d3    ; Get length of message
  923.     bsr    PrintMSG        ; Print the message
  924.     lea    SixtyFourKMSG,a0    ; Get address of message
  925.     move.l    SixtyFourKMSGLen,d3    ; Get length of message
  926.     lea    SegAllocSize(a4,d6),a3    ; Get address of number
  927.     tst.w    (a3)            ; Is it zero? Which means 64k allocated
  928.     beq    AllocWholeSegment    ; If 64k size then print that
  929.     bsr    PrePrintSingleIntelWord    ; Prepare file segment length for printing
  930.  
  931. AllocWholeSegment
  932.     bsr    PrintMSG        ; Print message
  933.  
  934.     lea    SegmentTypeMSG,a0    ; Get address of message    Print "Segment type"
  935.     move.l    SegmentTypeMSGLen,d3    ; Get length of message
  936.     bsr    PrintMSG        ; Print the message
  937.  
  938.     lea    DataMSG,a0        ; Get address of message    If bit 0 of flag set then segment is type data
  939.     move.l    DataMSGLen,d3        ; Get length of message
  940.     btst    #0,SegFlags(a4,d6)    ; Test bit 0 of segment flags
  941.     bne    PrintSegmentType    ; If set then print type data
  942.     lea    CodeMSG,a0        ; Get address of message      else print type code
  943.     move.l    CodeMSGLen,d3        ; Get length of message
  944.  
  945. PrintSegmentType
  946.     bsr    PrintMSG        ; Print the message
  947.  
  948.     btst    #1,SegFlags(a4,d6)    ; Test bit 1 of seg flags    If bit 1 set then print "Loader allocates mem..."
  949.     beq    NoLoaderAllocation    ; If zero then no allocation
  950.     lea    LoaderAllocMSG,a0    ; Get address of message
  951.     move.l    LoaderAllocMSGLen,d3    ; Get length of message
  952.     bsr    PrintMSG        ; Print the message
  953.  
  954. NoLoaderAllocation
  955.  
  956.     btst    #2,SegFlags(a4,d6)    ; Test bit 2 of seg flags    If bit 2 set then print "Segment is loaded..."
  957.     beq    SegmentNotLoaded    ; If zero then segment not loaded
  958.     lea    SegmentLoadedMSG,a0    ; Get address of message
  959.     move.l    SegmentLoadedMSGLen,d3    ; Get length of message
  960.     bsr    PrintMSG        ; Print the message
  961.  
  962. SegmentNotLoaded
  963.  
  964.     lea    MoveableMSG,a0        ; Get address of message    If bit 4 of flag set then segment is moveable
  965.     move.l    MoveableMSGLen,d3    ; Get length of message
  966.     btst    #4,SegFlags(a4,d6)    ; Test bit 4 of segment flags
  967.     bne    PrintSegmentReloc    ; If set then print type moveable
  968.     lea    FixedMSG,a0        ; Get address of message      else print type fixed
  969.     move.l    FixedMSGLen,d3        ; Get length of message
  970.  
  971. PrintSegmentReloc
  972.     bsr    PrintMSG        ; Print the message
  973.  
  974.     lea    ShareMSG,a0        ; Get address of message    If bit 5 of flag set then segment is pure or sharable
  975.     move.l    ShareMSGLen,d3        ; Get length of message
  976.     btst    #5,SegFlags(a4,d6)    ; Test bit 5 of segment flags
  977.     bne    PrintSegmentSharing    ; If set then print type shareable
  978.     lea    NonShareMSG,a0        ; Get address of message      else print type non shareable
  979.     move.l    NonShareMSGLen,d3    ; Get length of message
  980.  
  981. PrintSegmentSharing
  982.     bsr    PrintMSG        ; Print the message
  983.  
  984.     lea    PreLoadMSG,a0        ; Get address of message    If bit 6 of flag set then preload segment
  985.     move.l    PreLoadMSGLen,d3    ; Get length of message
  986.     btst    #6,SegFlags(a4,d6)    ; Test bit 6 of segment flags
  987.     bne    PrintSegmentLoadType    ; If set then print type preload
  988.     lea    LoadOnCallMSG,a0    ; Get address of message      else print type load on call
  989.     move.l    LoadOnCallMSGLen,d3    ; Get length of message
  990.  
  991. PrintSegmentLoadType
  992.     bsr    PrintMSG        ; Print the message
  993.  
  994.     btst    #7,SegFlags(a4,d6)    ; Test bit 7 of segment flags    If bit 7 set then
  995.     beq    RandomAccess        ; Random access
  996.     lea    ReadOnlyMSG,a0    ; Get address of message
  997.     move.l    ReadOnlyMSGLen,d3    ; Get length of message
  998.     btst    #0,SegFlags(a4,d6)    ; Test bit 0 of segment flags      If bit 0 set then print "READONLY"
  999.     bne    ReadOnlySegment        ; Print "READONLY" if data seg
  1000.     lea    ExecuteOnlyMSG,a0    ; Get address of message        else print "EXECUTEONLY"
  1001.     move.l    ExecuteOnlyMSGLen,d3    ; Get length of message
  1002.  
  1003. ReadOnlySegment
  1004.     bsr    PrintMSG        ; Print the message
  1005.  
  1006. RandomAccess                ; Come here for no access restrictions
  1007.  
  1008.     btst    #0,SegFlags+1(a4,d6)    ; Test bit 8 of segment flags    If bit 8 set then print "Segment contains relocation data"
  1009.     beq    NoRelocation        ; Jump if bit not set
  1010.     lea    SegRelocationMSG,a0    ; Get address of message
  1011.     move.l    SegRelocationMSGLen,d3    ; Get length of message
  1012.     bsr    PrintMSG        ; Print the message
  1013. NoRelocation
  1014.  
  1015.     btst    #0,SegFlags+1(a4,d6)    ; Test bit 8 of segment flags    If bit 8 set then print "Segment contains relocation data"
  1016.     beq    NoDiscard        ; Jump if bit not set
  1017.     lea    SegDiscardMSG,a0    ; Get address of message
  1018.     move.l    SegDiscardMSGLen,d3    ; Get length of message
  1019.     bsr    PrintMSG        ; Print the message
  1020. NoDiscard
  1021.  
  1022.  
  1023.     addq.l    #8,d6            ; Bump to next entry
  1024.     addq.w    #1,d5            ; Increment the segment counter
  1025.     subq.w    #1,d7            ; Decrement the loop counter
  1026.     bne    PrintSegmentTableEntry    ; Loop if not zero
  1027.     rts                ; Finish printing segment table
  1028.  
  1029.  
  1030. **---------------------------------------
  1031. **
  1032. ** Print resource table
  1033. **
  1034. **---------------------------------------
  1035.  
  1036. PrintResourceTable
  1037.  
  1038.     move.l    #NULL,d0        ; Clear new signal                Test for CTRL_C
  1039.     move.l    d0,d1            ; Clear signal mask
  1040.     move.l    AbsExecBase,a6        ; Get exec.library base
  1041.     jsr    _LVOSetSignal(a6)    ; Get signals
  1042.     move.l    DosBase(a5),a6        ; Get dos.library base
  1043.     and.l    #SIGBREAKF_CTRL_C,d0    ; Test for CTRL_C
  1044.     beq    ResNoEscape        ; Jump if pressed
  1045.     rts
  1046.  
  1047. ResNoEscape
  1048.  
  1049.     lea    RscTableOffsetMSG,a0    ; Get address of message    ; Print offset to resource table
  1050.     move.l    RscTableOffsetMSGLen,d3    ; Get length of message
  1051.     bsr    PrintMSG        ; Print the message
  1052.     lea    RscTableOffset(a4),a3    ; Get pointer to offset
  1053.     move.w    (a3),d7            ; Save offset of resource table
  1054.     rol.w    #8,d7            ; Swap bytes for intel word
  1055.     bsr    PrePrintSingleIntelWord    ; Prepare number for printing
  1056.     bsr    PrintMSG        ; Print the number
  1057.  
  1058. ; Print contents of resource table
  1059.  
  1060.     lea    rscAlignShiftMSG,a0    ; Get address of message    ;   Print rscAlignShift
  1061.     move.l    rscAlignShiftMSGLen,d3    ; Get length of message
  1062.     bsr    PrintMSG        ; Print the message
  1063.     lea    rscAlignShift(a4,d7.w),a3    ; Get pointer to shift count
  1064.     move.w    (a3),d4            ; Get shift count
  1065.     rol.w    #8,d4            ; Position bytes correctly
  1066.     cmp.w    #31,d4            ; Check validity
  1067.     bgt    NoResourceTable        ; Jump if out of bounds
  1068.     bsr    PrePrintSingleIntelWord    ; Prepare number for printing
  1069.     bsr    PrintMSG        ; Print the number
  1070.     move.w    d7,d6            ; Get pointer to table
  1071.     addq.w    #2,d6            ; Increment pointer in
  1072.  
  1073. ; Print rscTypes
  1074.  
  1075. PrintrscTypes                                ;     REPEAT
  1076.  
  1077.     move.l    #NULL,d0        ; Clear new signal                Test for CTRL_C
  1078.     move.l    d0,d1            ; Clear signal mask
  1079.     move.l    AbsExecBase,a6        ; Get exec.library base
  1080.     jsr    _LVOSetSignal(a6)    ; Get signals
  1081.     move.l    DosBase(a5),a6        ; Get dos.library base
  1082.     and.l    #SIGBREAKF_CTRL_C,d0    ; Test for CTRL_C
  1083.     beq    RscNoEscape        ; Jump if not pressed
  1084.     rts
  1085.  
  1086. RscNoEscape
  1087.     lea    ResourceTypeMSG,a0    ; Get address of message          Print "Resource type : "
  1088.     move.l    ResourceTypeMSGLen,d3    ; Get length of message
  1089.     bsr    PrintMSG        ; Print the message
  1090.     clr.l    d0            ; Put d0 to zero
  1091.     move.w    (a4,d6.w),d0        ; Get rtTypeID
  1092.     rol.w    #8,d0            ; Position bytes correctly
  1093.      move.l    d0,a0            ; Get offset of string              If rtTypeID < $8000 then
  1094.     add.w    d7,a0            ; Add offset of resource table
  1095.     clr.l    d3            ; Clear d3
  1096.     add.l    a4,a0            ; Add base of header
  1097.     move.b    (a0)+,d3        ; Get length of name
  1098.     cmp.w    #$8000,d0        ; Compare with $8000                n=(rtTypeID+resource table base)
  1099.     blt    PrintTherscType        ; Print if less than                Print n chars from above address+1
  1100.  
  1101.     lea    RT_CursorMSG,a0        ; Get address of message          If rtTypeID = $8000 + 1  then print "RT_CURSOR"
  1102.     move.l    RT_CursorMSGLen,d3    ; Get length of message
  1103.     cmp.w    #$8000+1,d0        ; Compare with $8000+1
  1104.     beq    PrintTherscType        ; Print if equal
  1105.  
  1106.     lea    RT_BitmapMSG,a0        ; Get address of message          If rtTypeID = $8000 + 2  then print "RT_BITMAP"
  1107.     move.l    RT_BitmapMSGLen,d3    ; Get length of message
  1108.     cmp.w    #$8000+2,d0        ; Compare with $8000+2
  1109.     beq    PrintTherscType        ; Print if equal
  1110.  
  1111.     lea    RT_IconMSG,a0        ; Get address of message          If rtTypeID = $8000 + 3  then print "RT_ICON"
  1112.     move.l    RT_IconMSGLen,d3    ; Get length of message
  1113.     cmp.w    #$8000+3,d0        ; Compare with $8000+3
  1114.     beq    PrintTherscType        ; Print if equal
  1115.  
  1116.     lea    RT_MenuMSG,a0        ; Get address of message          If rtTypeID = $8000 + 4  then print "RT_MENU"
  1117.     move.l    RT_MenuMSGLen,d3    ; Get length of message
  1118.     cmp.w    #$8000+4,d0        ; Compare with $8000+4
  1119.     beq    PrintTherscType        ; Print if equal
  1120.  
  1121.     lea    RT_DialogMSG,a0        ; Get address of message          If rtTypeID = $8000 + 5  then print "RT_DIALOG"
  1122.     move.l    RT_DialogMSGLen,d3    ; Get length of message
  1123.     cmp.w    #$8000+5,d0        ; Compare with $8000+5
  1124.     beq    PrintTherscType        ; Print if equal
  1125.  
  1126.     lea    RT_StringMSG,a0        ; Get address of message          If rtTypeID = $8000 + 6  then print "RT_STRING"
  1127.     move.l    RT_StringMSGLen,d3    ; Get length of message
  1128.     cmp.w    #$8000+6,d0        ; Compare with $8000+6
  1129.     beq    PrintTherscType        ; Print if equal
  1130.  
  1131.     lea    RT_FontDirMSG,a0    ; Get address of message          If rtTypeID = $8000 + 7  then print "RT_FONTDIR"
  1132.     move.l    RT_FontDirMSGLen,d3    ; Get length of message
  1133.     cmp.w    #$8000+7,d0        ; Compare with $8000+7
  1134.     beq    PrintTherscType        ; Print if equal
  1135.  
  1136.     lea    RT_FontMSG,a0        ; Get address of message          If rtTypeID = $8000 + 8  then print "RT_FONT"
  1137.     move.l    RT_FontMSGLen,d3    ; Get length of message
  1138.     cmp.w    #$8000+8,d0        ; Compare with $8000+8
  1139.     beq    PrintTherscType        ; Print if equal
  1140.  
  1141.     lea    RT_AcceleratorMSG,a0    ; Get address of message          If rtTypeID = $8000 + 9  then print "RT_ACCELERATOR"
  1142.     move.l    RT_AcceleratorMSGLen,d3    ; Get length of message
  1143.     cmp.w    #$8000+9,d0        ; Compare with $8000+9
  1144.     beq    PrintTherscType        ; Print if equal
  1145.  
  1146.     lea    RT_RCDataMSG,a0        ; Get address of message          If rtTypeID = $8000 + 10 then print "RT_RCDATA"
  1147.     move.l    RT_RCDataMSGLen,d3    ; Get length of message
  1148.     cmp.w    #$8000+10,d0        ; Compare with $8000+10
  1149.     beq    PrintTherscType        ; Print if equal
  1150.  
  1151.     lea    RT_Group_CursorMSG,a0    ; Get address of message          If rtTypeID = $8000 + 12 then print "RT_GROUP_CURSOR"
  1152.     move.l    RT_Group_CursorMSGLen,d3; Get length of message
  1153.     cmp.w    #$8000+12,d0        ; Compare with $8000+12
  1154.     beq    PrintTherscType        ; Print if equal
  1155.  
  1156.     lea    RT_Group_IconMSG,a0    ; Get address of message          If rtTypeID = $8000 + 14 then print "RT_GROUP_ICON"
  1157.     move.l    RT_Group_IconMSGLen,d3    ; Get length of message
  1158.     cmp.w    #$8000+14,d0        ; Compare with $8000+14
  1159.     beq    PrintTherscType        ; Print if equal
  1160.  
  1161.     lea    RT_VersionInfoMSG,a0    ; Get address of message          If rtTypeID = $8000 + 16 then print "Version info?"
  1162.     move.l    RT_VersionInfoMSGLen,d3    ; Get length of message
  1163.     cmp.w    #$8000+16,d0        ; Compare with $8000+16
  1164.     beq    PrintTherscType        ; Print if equal
  1165.  
  1166.     lea    RT_UnkRscTypeMSG,a0    ; Get address of message          ELSE Print "Unknown resource type",rtTypeID
  1167.     move.l    RT_UnkRscTypeMSGLen,d3    ; Get length of message
  1168.     bsr    PrintMSG        ; Print the message
  1169.     lea    (a4,d6.w),a3        ; Get address of number
  1170.     bsr    PrePrintSingleIntelWord    ; Prepare number for printing
  1171.  
  1172. PrintTherscType
  1173.     bsr    PrintMSG        ; Print the message
  1174.     addq.w    #2,d6            ; Increment pointer
  1175.  
  1176.     lea    rtResourceCountMSG,a0    ; Get address of message        Print rtResourceCount
  1177.     move.l    rtResourceCountMSGLen,d3; Get length of message
  1178.     bsr    PrintMSG        ; Print the message
  1179.     lea    (a4,d6.w),a3        ; Get address of rtResourceCount
  1180.     move.w    (a3),d5
  1181.     bsr    PrePrintSingleIntelWord    ; Prepare word for printing
  1182.     bsr    PrintMSG        ; Print the number
  1183.  
  1184.     addq.w    #6,d6            ; Increment pointer            Skip rtReserved (longword)
  1185.  
  1186. ;    move.w    (a3),d5            ; d5 = rtResourceCount            FOR n-1 to rtResourceCount
  1187.     rol.w    #8,d5            ; Position the bytes right
  1188.  
  1189. PrintrtNameInfo                                ;      Print rtNameInfo
  1190.     lea    rnOffsetMSG,a0        ; Get address of message            Print rnOffset
  1191.     move.l    rnOffsetMSGLen,d3    ; Get length of message
  1192.     bsr    PrintMSG        ; Print the message
  1193.     clr.l    d0            ; Clear d0
  1194.     move.w    rnOffset(a4,d6.w),d0    ; Get rnOffset
  1195.     rol.w    #8,d0            ; Position the bytes correctly
  1196.     lsl.l    d4,d0            ; Shift to size
  1197.     bsr    PrintMotoRegNum        ; Print the number
  1198.  
  1199.     lea    rnLengthMSG,a0        ; Get address of message    ;        Print rnLength
  1200.     move.l    rnLengthMSGLen,d3    ; Get length of message
  1201.     bsr    PrintMSG        ; Print the message
  1202.     clr.l    d0            ; Clear d0
  1203.     move.w    rnLength(a4,d6.w),d0    ; Get rnOffset
  1204.     rol.w    #8,d0            ; Position the bytes correctly
  1205.     lsl.l    d4,d0            ; Shift to size
  1206.     bsr    PrintMotoRegNum        ; Print the number
  1207.  
  1208. ; Print rnFlags                                        Print rnFlags
  1209.  
  1210.     lea    rnFlagsMSG,a0        ; Get address of message              Print "Resource flags"
  1211.     move.l    rnFlagsMSGLen,d3    ; Get length of message
  1212.     bsr    PrintMSG        ; Print the message
  1213.     btst    #4,rnFlags(a4,d6.w)    ; Test bit 4 of rnFlags                  If bit 4 set then print "MOVEABLE"
  1214.     beq    rnFlagsNotMoveable    ; Jump if flag not set
  1215.     lea    rnFlagsMoveableMSG,a0    ; Get address of message
  1216.     move.l    rnFlagsMoveableMSGLen,d3; Get length of message
  1217.     bsr    PrintMSG        ; Print the message
  1218. rnFlagsNotMoveable
  1219.     btst    #5,rnFlags(a4,d6.w)    ; Test bit 6 of rnFlags                  If bit 5 set then print "PURE"
  1220.     beq    rnFlagsNotPure        ; Jump if flag not set
  1221.     lea    rnFlagsPureMSG,a0    ; Get address of message
  1222.     move.l    rnFlagsPureMSGLen,d3    ; Get length of message
  1223.     bsr    PrintMSG        ; Print the message
  1224. rnFlagsNotPure
  1225.     btst    #6,rnFlags(a4,d6.w)    ; Test bit 6 of rnFlags                  If bit 6 set then print "PRELOAD"
  1226.     beq    PrintrnID        ; Jump if flag not set
  1227.     lea    rnFlagsPreloadMSG,a0    ; Get address of message
  1228.     move.l    rnFlagsPreloadMSGLen,d3    ; Get length of message
  1229.     bsr    PrintMSG        ; Print the message
  1230.  
  1231. PrintrnID                                ;        Print rnID
  1232.     lea    rnIDMSG,a0        ; Get address of message              Print "Resource ID is"
  1233.     move.l    rnIDMSGLen,d3        ; Get length of message
  1234.     bsr    PrintMSG        ; Print the message
  1235.     move.w    rnID(a4,d6.w),d0    ; Get rnID                      If rnID >= $8000 then print rnID-$8000
  1236.     bclr    #7,d0            ; Clear MSBit of intel word
  1237.     lea    StackEquation(a5),a3    ; Get temporary address
  1238.     move.w    d0,(a3)            ; Store ID
  1239.     bsr    PrePrintSingleIntelWord    ; Prepare the word for printing
  1240.     btst    #7,rnID+1(a4,d6.w)    ; Test bit 15 of rnID
  1241.     bne    EndFORrnNameInfo    ; Jump if set
  1242.     lea    rnID(a4,d6.w),a0    ; Get rnID address                ELSE
  1243.     clr.l    d0            ; Clear scratch register              x=(rnID+resource table base)
  1244.     move.l    d0,d3            ; Clear d3 also                      Print x chars from above table
  1245.     move.w    (a0),d0            ; Get offset
  1246.     rol.w    #8,d0            ; Position bytes correctly
  1247.     move.l    d0,a0            ; Get address of string
  1248.     add.w    d7,a0            ; Add base of resource table
  1249.     add.l    a4,a0            ; Add base of header
  1250.     move.b    (a0)+,d3        ; Get length of string
  1251.  
  1252. EndFORrnNameInfo
  1253.     bsr    PrintMSG        ; Print the message
  1254.     add.w    #12,d6            ; Skip to next entry                  Skip to next entry
  1255.     subq.w    #1,d5            ; Decrement n FOR loop
  1256.     bne    PrintrtNameInfo        ; Loop if not zero        ;        END ; FOR
  1257.     tst.w    (a4,d6.w)        ; Test next byte
  1258.     bne    PrintrscTypes        ; Loop if not zero        ;      UNTIL rscEndTypes ; ie. next byte = 0
  1259. NoResourceTable
  1260.     rts                ; End of printing
  1261.  
  1262.  
  1263. **------------------------------------------
  1264. **
  1265. ** Print resident-name table
  1266. **
  1267. **------------------------------------------
  1268.  
  1269. PrintResNameTable
  1270.  
  1271.     move.l    #NULL,d0        ; Clear new signal                Test for CTRL_C
  1272.     move.l    d0,d1            ; Clear signal mask
  1273.     move.l    AbsExecBase,a6        ; Get exec.library base
  1274.     jsr    _LVOSetSignal(a6)    ; Get signals
  1275.     move.l    DosBase(a5),a6        ; Get dos.library base
  1276.     and.l    #SIGBREAKF_CTRL_C,d0    ; Test for CTRL_C
  1277.     beq    ResNamNoEscape        ; Jump if pressed
  1278.     rts
  1279.  
  1280. ResNamNoEscape
  1281.  
  1282.     lea    ResNamTableMSG,a0    ; Get address of message    Print resident-name table
  1283.     move.l    ResNamTableMSGLen,d3    ; Get length of message
  1284.     bsr    PrintMSG        ; Print the message
  1285.     clr.l    d7            ; Clear d7              Get address of resident-name table
  1286.     move.w    ResNameTabOffset(a4),d7    ; Get offset
  1287.     rol.w    #8,d7            ; Position bytes correctly
  1288.     add.l    a4,d7            ; Get address of table
  1289.     move.l    d7,a0            ; Put in address register      Skip first entry
  1290.     move.b    (a0)+,d3        ; Get length of module            Get length of string
  1291.     add.l    d3,a0            ; Skip past name            Add to pointer
  1292.     addq.l    #2,a0            ; Skip ordinal                Add 2 to pointer to skip ordinal
  1293. PrintResNamTabString
  1294.     tst.b    (a0)            ; Test next byte          WHILE next byte !=0
  1295.     beq    ResNamTabFinished    ; Jump if 0
  1296.     move.l    a0,d7            ; Save pointer
  1297.     lea    SixBlankSpacesMSG,a0    ; Get address of message
  1298.     move.l    SixBlankSpacesMSGLen,d3    ; Get length of message
  1299.     bsr    PrintMSG        ; Print the message
  1300.     move.l    d7,a0            ; Get pointer                Get length of string
  1301.     move.b    (a0)+,d3        ; Get length of string
  1302.     move.l    a0,d7            ; Save pointer
  1303.     add.l    d3,d7            ; Add string length            Skip pointer past string
  1304.     bsr    PrintMSG        ; Print the string            Print string
  1305.     lea    SixBlankSpacesMSG,a0    ; Get address of message
  1306.     move.l    SixBlankSpacesMSGLen,d3    ; Get length of message
  1307.     bsr    PrintMSG        ; Print the message
  1308.     move.l    d7,a3            ; Put pointer in a3            Print ordinal
  1309.     bsr    PrePrintSingleIntelWord    ; Prepare the number
  1310.     bsr    PrintMSG        ; Print the number
  1311.     addq.l    #2,d7            ; Skip past ordinal
  1312.     move.l    d7,a0            ; Get pointer
  1313.     bra    PrintResNamTabString    ; Loop                    END ; WHILE
  1314.  
  1315. ResNamTabFinished
  1316.     rts                ; Return
  1317.  
  1318.  
  1319. **--------------------------------------------------
  1320. **
  1321. ** Print module-reference and imported-name tables
  1322. **
  1323. **--------------------------------------------------
  1324.  
  1325. PrintModImpTables
  1326.  
  1327.     move.l    #NULL,d0        ; Clear new signal                Test for CTRL_C
  1328.     move.l    d0,d1            ; Clear signal mask
  1329.     move.l    AbsExecBase,a6        ; Get exec.library base
  1330.     jsr    _LVOSetSignal(a6)    ; Get signals
  1331.     move.l    DosBase(a5),a6        ; Get dos.library base
  1332.     and.l    #SIGBREAKF_CTRL_C,d0    ; Test for CTRL_C
  1333.     beq    ModImpNoEscape        ; Jump if pressed
  1334.     rts
  1335.  
  1336. ModImpNoEscape
  1337.  
  1338.     lea    ModTableEntriesMSG,a0    ; Get address of message    Print module-reference and imported-name tables
  1339.     move.l    ModTableEntriesMSGLen,d3; Get length of message          Print number of entries in module-reference table
  1340.     bsr    PrintMSG        ; Print the message
  1341.     lea    ModTableEntries(a4),a3    ; Point to entries in mod tab
  1342.     move.w    (a3),d7            ; Get number of entries
  1343.     rol.w    #8,d7            ; Position bytes correctly
  1344.     bsr    PrePrintSingleIntelWord    ; Prepare for printing
  1345.     bsr    PrintMSG        ; Print the number
  1346.     clr.l    d6            ; Clear d6              Get address of imported-name table
  1347.     move.w    ImpTableOffset(a4),d6    ; Get offset to imp tab
  1348.     rol.w    #8,d6            ; Position the bytes correctly
  1349.     add.l    a4,d6            ; Add base of header
  1350.     addq.w    #1,d7            ; Add extra 1
  1351. PrintModRefStrings                            ; FOR n=1 to number of entries in module-reference table
  1352.     lea    SixBlankSpacesMSG,a0    ; Get address of message
  1353.     move.l    SixBlankSpacesMSGLen,d3    ; Get length of message
  1354.     bsr    PrintMSG        ; Print the message
  1355.     move.l    d6,a0            ; Get pointer                Get length of string
  1356.     move.b    (a0)+,d3        ; Get length of string
  1357.     move.l    a0,d6            ; Save pointer                Get address of string
  1358.     add.l    d3,d6            ; Skip past string
  1359.     bsr    PrintMSG        ; Print string                Print string
  1360.     lea    NewLineMSG,a0        ; Get address of message
  1361.     move.l    NewLineMSGLen,d3    ; Get length of message
  1362.     bsr    PrintMSG        ; Print the message
  1363.     subq.w    #1,d7            ; Decrement counter            END ; FOR
  1364.     bne    PrintModRefStrings    ; Loop
  1365.     rts                ; Finished
  1366.  
  1367.  
  1368. **------------------------------------------
  1369. **
  1370. ** Print non-resident name table
  1371. **
  1372. **------------------------------------------
  1373.  
  1374. PrintNonResNameTable
  1375.  
  1376.     move.l    #NULL,d0        ; Clear new signal                Test for CTRL_C
  1377.     move.l    d0,d1            ; Clear signal mask
  1378.     move.l    AbsExecBase,a6        ; Get exec.library base
  1379.     jsr    _LVOSetSignal(a6)    ; Get signals
  1380.     move.l    DosBase(a5),a6        ; Get dos.library base
  1381.     and.l    #SIGBREAKF_CTRL_C,d0    ; Test for CTRL_C
  1382.     beq    NonResNoEscape        ; Jump if pressed
  1383.     rts
  1384.  
  1385. NonResNoEscape
  1386.  
  1387.     lea    NonResNamTableMSG,a0    ; Get address of message    Print resident-name table
  1388.     move.l    NonResNamTableMSGLen,d3    ; Get length of message
  1389.     bsr    PrintMSG        ; Print the message
  1390.     clr.l    d7            ; Clear d7              Get address of resident-name table
  1391.     move.l    NonResNamTabOffset(a4),d7    ; Get offset
  1392.     rol.w    #8,d7            ; Position bytes correctly
  1393.     swap    d7            ; swap register halves
  1394.     rol.w    #8,d7            ; Position bytes correctly
  1395.     sub.l    HeaderOffset(a5),d7    ; Get address of table
  1396.     add.l    a4,d7            ; Add offset to table
  1397.     move.l    d7,a0            ; Put in address register      Skip first entry
  1398.     move.b    (a0)+,d3        ; Get length of module            Get length of string
  1399.     add.l    d3,a0            ; Skip past name            Add to pointer
  1400.     addq.l    #2,a0            ; Skip ordinal                Add 2 to pointer to skip ordinal
  1401. PrintNonResNamTabString
  1402.     tst.b    (a0)            ; Test next byte          WHILE next byte !=0
  1403.     beq    NonResNamTabFinished    ; Jump if 0
  1404.     move.l    a0,d7            ; Save pointer
  1405.     lea    SixBlankSpacesMSG,a0    ; Get address of message
  1406.     move.l    SixBlankSpacesMSGLen,d3    ; Get length of message
  1407.     bsr    PrintMSG        ; Print the message
  1408.     move.l    d7,a0            ; Get pointer                Get length of string
  1409.     move.b    (a0)+,d3        ; Get length of string
  1410.     move.l    a0,d7            ; Save pointer
  1411.     add.l    d3,d7            ; Add string length            Skip pointer past string
  1412.     bsr    PrintMSG        ; Print the string            Print string
  1413.     lea    SixBlankSpacesMSG,a0    ; Get address of message
  1414.     move.l    SixBlankSpacesMSGLen,d3    ; Get length of message
  1415.     bsr    PrintMSG        ; Print the message
  1416.     move.l    d7,a3            ; Put pointer in a3            Print ordinal
  1417.     bsr    PrePrintSingleIntelWord    ; Prepare the number
  1418.     bsr    PrintMSG        ; Print the number
  1419.     addq.l    #2,d7            ; Skip past ordinal
  1420.     move.l    d7,a0            ; Get pointer
  1421.     bra    PrintNonResNamTabString    ; Loop                    END ; WHILE
  1422.  
  1423. NonResNamTabFinished
  1424.     rts                ; Return
  1425.  
  1426.  
  1427. **---------------------------------------------
  1428. **
  1429. ** Print entry table
  1430. **
  1431. **---------------------------------------------
  1432.  
  1433. PrintEntryTable                            ;    Print entry table
  1434.  
  1435.     move.l    #NULL,d0        ; Clear new signal                Test for CTRL_C
  1436.     move.l    d0,d1            ; Clear signal mask
  1437.     move.l    AbsExecBase,a6        ; Get exec.library base
  1438.     jsr    _LVOSetSignal(a6)    ; Get signals
  1439.     move.l    DosBase(a5),a6        ; Get dos.library base
  1440.     and.l    #SIGBREAKF_CTRL_C,d0    ; Test for CTRL_C
  1441.     beq    EntNoEscape        ; Jump if pressed
  1442.     rts
  1443.  
  1444. EntNoEscape
  1445.  
  1446.     lea    EntryTableMSG,a0    ; Get address of message
  1447.     move.l    EntryTableMSGLen,d3    ; Get length of message
  1448.     bsr    PrintMSG        ; Print the message
  1449.     tst.w    EntryLength(a4)        ; Test number              Test length of entry table
  1450.     beq    EntryTableFinished    ; Quit if 0        
  1451.     clr.l    d5            ; Clear d5
  1452.     moveq.l    #1,d6            ; Initialize entry counter      If length != 0 then
  1453.     move.w    EntryOffset(a4),d7    ; Get offset                Get address of entry table
  1454.     rol.w    #8,d7            ; Position bytes correctly
  1455. PrintEntryTableBundles                        ;        REPEAT
  1456.  
  1457.     move.l    #NULL,d0        ; Clear new signal                Test for CTRL_C
  1458.     move.l    d0,d1            ; Clear signal mask
  1459.     move.l    AbsExecBase,a6        ; Get exec base
  1460.     jsr    _LVOSetSignal(a6)    ; Get signals
  1461.     move.l    DosBase(a5),a6        ; Get dos.library base
  1462.     and.l    #SIGBREAKF_CTRL_C,d0    ; Test for CTRL_C
  1463.     beq    EntryNoEscape        ; Jump if pressed
  1464.     rts
  1465.  
  1466. EntryNoEscape
  1467.     move.b    EntryBndlNum(a4,d7.w),d5; Get number of entries              Get number of entries in bundle
  1468.     move.b    EntryBndlTyp(a4,d7.w),d4; Get entry type              Get bundle type
  1469.     addq.w    #2,d7            ; Add 2 to pointer              Add 2 to pointer
  1470.     tst.b    d4            ; Is d4 = 0 ?                  If bundle type = 0 then    ; Null entries
  1471.     beq    EntryZeroBundle        ; Branch if 0
  1472.     cmp.b    #$FE,d4            ; Is d4 = $FE                  If bundle type = $FE then    ; Constant pointer
  1473.     beq    EntryConstBundle    ; Jump if $FE
  1474.     cmp.b    #$FF,d4            ; Is d4 = $FF
  1475.     beq    EntryMoveBundle        ; Jump if $FF                  If bundle type = $FF then    ; Movable segment
  1476.  
  1477. ; Print fixed segment records                              ELSE
  1478.  
  1479.     lea    EntryFixSegRecrMSG,a0    ; Get address of message        Print "Fixed segment records : "
  1480.     move.l    EntryFixSegRecrMSGLen,d3; Get length of message
  1481.     bsr    PrintMSG        ; Print the message
  1482.     move.b    d5,d3            ; Move byte for printing
  1483.     bsr    PrintByte        ; Print a byte number            ,entries in bundle,
  1484.     lea    EntryEntriesSegMSG,a0    ; Get address of message        " entries.    Segment : "
  1485.     move.l    EntryEntriesSegMSGLen,d3; Get length of message
  1486.     bsr    PrintMSG        ; Print the message
  1487.     move.b    d4,d3            ; Move byte for printing        ,bundle type
  1488.     bsr    PrintByte        ; Print the number
  1489. EntryPrintFixSeg                            ;    FOR n=1 to entries in bundle
  1490.     bsr    PrintEntryNumber    ; Print entry                  Print "Entry ",entry counter
  1491.     lea    EntryFixOffsetMSG,a0    ; Get address of message          Print "Offset : ",EntryFixOffset
  1492.     move.l    EntryFixOffsetMSGLen,d3    ; Get length of message
  1493.     bsr    PrintMSG        ; Print the message
  1494.     lea    EntryFixOffset(a4,d7.w),a3    ; Get address of offset
  1495.     bsr    PrePrintSingleIntelWord    ; Prepare num for printing
  1496.     subq.l    #1,d3            ; No new line
  1497.     bsr    PrintMSG        ; Print number
  1498.     btst    #0,EntryFixFlags(a4,d7.w)    ; Test flag              If bit 0 of EntryFixFlags = 1 then
  1499.     beq    EntryFixNotExported    ; Jump if 0
  1500.     bsr    PrintEntryExported    ; Print exported                Print Exported
  1501. EntryFixNotExported
  1502.     btst    #1,EntryFixFlags(a4,d7.w)    ; Test flag              If bit 1 of EntryFixFlags = 1 then
  1503.     beq    EntryFixNotGlobal    ; Jump if 0
  1504.     lea    SingleDataModelMSG,a0    ; Get address of message            Print "SINGLEDATA"
  1505.     move.l    SingleDataModelMSGLen,d3; Get length of message
  1506.     bsr    PrintMSG        ; Print the message
  1507. EntryFixNotGlobal
  1508.     addq.w    #3,d7            ; Add 3 to pointer              Add 3 to pointer
  1509.     addq.l    #1,d6            ; Increment entry number          END ; FOR
  1510.     subq.b    #1,d5            ; Decrement number of entries in bundle
  1511.     bne    EntryPrintFixSeg    ; Loop
  1512.     bra    EntryFinished        ; Finished
  1513.  
  1514. ; Print null entry bundles
  1515.  
  1516. EntryZeroBundle
  1517.     lea    EntryNullEntriesMSG,a0    ; Get address of message        Print "Null entries : "
  1518.     move.l    EntryNullEntriesMSGLen,d3    ; Get length of message
  1519.     bsr    PrintMSG        ; Print the message
  1520.     move.b    d5,d3            ; Get number of entries            ,entries
  1521.     bsr    PrintByte        ; Print the number
  1522.     add.l    d5,d6            ; Add entries to counter        Add entries to entry counter
  1523.     bra    EntryFinished        ; Null entries done
  1524.  
  1525. ; Constant pointer
  1526.  
  1527. EntryConstBundle
  1528.     lea    EntryConstantMSG,a0    ; Get address of message        Print "Constant records : "
  1529.     move.l    EntryConstantMSGLen,d3    ; Get length of message
  1530.     bsr    PrintMSG        ; Print the message
  1531.     move.b    d5,d3            ; Move byte for printing
  1532.     bsr    PrintByte        ; Print a byte number            ,entries in bundle,
  1533.     lea    EntryEntriesMSG,a0    ; Get address of message        " entries."
  1534.     move.l    EntryEntriesMSGLen,d3    ; Get length of message
  1535.     bsr    PrintMSG        ; Print the message
  1536. EntryPrintConstSeg                            ;    FOR n=1 to entries in bundle
  1537.     bsr    PrintEntryNumber    ; Print entry                  Print "Entry ",entry counter
  1538.     lea    EntryFixOffsetMSG,a0    ; Get address of message          Print "Offset : ",EntryConstValue
  1539.     move.l    EntryFixOffsetMSGLen,d3    ; Get length of message
  1540.     bsr    PrintMSG        ; Print the message
  1541.     lea    EntryConstValue(a4,d7.w),a3    ; Get address of offset
  1542.     bsr    PrePrintSingleIntelWord    ; Prepare num for printing
  1543.     subq.l    #1,d3            ; No new line
  1544.     bsr    PrintMSG        ; Print number
  1545.     btst    #0,EntryConstFlags(a4,d7.w)    ; Test flag              If bit 0 of EntryFixFlags = 1 then
  1546.     beq    EntryConstNotExported    ; Jump if 0
  1547.     bsr    PrintEntryExported    ; Print exported                Print Exported
  1548. EntryConstNotExported
  1549.     btst    #1,EntryConstFlags(a4,d7.w)    ; Test flag              If bit 1 of EntryFixFlags = 1 then
  1550.     beq    EntryConstNotGlobal    ; Jump if 0
  1551.     lea    SingleDataModelMSG,a0    ; Get address of message            Print "SINGLEDATA"
  1552.     move.l    SingleDataModelMSGLen,d3; Get length of message
  1553.     bsr    PrintMSG        ; Print the message
  1554. EntryConstNotGlobal
  1555.     addq.w    #3,d7            ; Add 3 to pointer              Add 3 to pointer
  1556.     addq.l    #1,d6            ; Increment entry number          END ; FOR
  1557.     subq.b    #1,d5            ; Decrement number of entries in bundle
  1558.     bne    EntryPrintConstSeg    ; Loop
  1559.     bra    EntryFinished        ; Finished
  1560.  
  1561. ; Print moveable segment record
  1562.  
  1563. EntryMoveBundle
  1564.     lea    EntryMoveRecrMSG,a0    ; Get address of message        Print "Movable segment records : "
  1565.     move.l    EntryMoveRecrMSGLen,d3    ; Get length of message
  1566.     bsr    PrintMSG        ; Print the message
  1567.     move.b    d5,d3            ; Move byte for printing
  1568.     bsr    PrintByte        ; Print a byte number            ,entries in bundle,
  1569.     lea    EntryEntriesMSG,a0    ; Get address of message        Print "entries"
  1570.     move.l    EntryEntriesMSGLen,d3    ; Get length of message
  1571.     bsr    PrintMSG        ; Print the message
  1572. EntryPrintMoveSeg                            ;    FOR n=1 to entries in bundle
  1573.     bsr    PrintEntryNumber    ; Print entry                  Print "Entry ",entry counter
  1574.     lea    EntryMoveSegMSG,a0    ; Get address of message          Print "Segment : ",EntryMoveSeg
  1575.     move.l    EntryMoveSegMSGLen,d3    ; Get length of message
  1576.     bsr    PrintMSG        ; Print the message
  1577.     move.b    EntryMoveSeg(a4,d7.w),d3; Get address of offset
  1578.     bsr    PrintByte        ; Prepare num for printing
  1579.     lea    EntryMoveOffsetMSG,a0    ; Get address of message          Print "Offset : ",EntryMoveOffset
  1580.     move.l    EntryMoveOffsetMSGLen,d3; Get length of message
  1581.     bsr    PrintMSG        ; Print the message
  1582.     lea    EntryMoveOffset(a4,d7.w),a3    ; Get address of offset
  1583.     bsr    PrePrintSingleIntelWord    ; Prepare num for printing
  1584.     subq.l    #1,d3            ; No new line
  1585.     bsr    PrintMSG        ; Print number
  1586.     btst    #0,EntryMoveFlags(a4,d7.w)    ; Test flag              If bit 0 of EntryFixFlags = 1 then
  1587.     beq    EntryMoveNotExported    ; Jump if 0
  1588.     bsr    PrintEntryExported    ; Print exported                Print Exported
  1589. EntryMoveNotExported
  1590.     btst    #1,EntryFixFlags(a4,d7.w)    ; Test flag              If bit 1 of EntryFixFlags = 1 then
  1591.     beq    EntryMoveNotGlobal    ; Jump if 0
  1592.     lea    GlobalMSG,a0        ; Get address of message            Print "GLOBAL"
  1593.     move.l    GlobalMSGLen,d3        ; Get length of message
  1594.     bsr    PrintMSG        ; Print the message
  1595. EntryMoveNotGlobal
  1596.     addq.w    #6,d7            ; Add 6 to pointer              Add 6 to pointer
  1597.     addq.l    #1,d6            ; Increment entry number          END ; FOR
  1598.     subq.b    #1,d5            ; Decrement number of entries in bundle
  1599.     bne    EntryPrintMoveSeg    ; LoopEntryFinished
  1600. EntryFinished
  1601.     tst.b    (a4,d7.w)        ; Is next byte = 0            UNTIL next byte = 0
  1602.     bne    PrintEntryTableBundles    ; Loop
  1603. EntryTableFinished
  1604.     rts                ; Finished
  1605.  
  1606. PrintEntryNumber
  1607.     lea    EntryNumberMSG,a0    ; Get address of message        Print "Entry : "
  1608.     move.l    EntryNumberMSGLen,d3    ; Get length of message
  1609.     bsr    PrintMSG        ; Print the message
  1610.     move.l    d6,d0            ; Get entry counter            ,entry counter
  1611.     rol.w    #8,d0            ; Convert to intel form
  1612.     swap    d0            ; Swap register halves
  1613.     rol.w    #8,d0            ; Convert to intel form
  1614.     move.l    d0,StackEquation(a5)    ; Put number for printing
  1615.     lea    StackEquation(a5),a3    ; Get address of number
  1616.     lea    TempBuffer(a5),a1    ; Get address of printing buffer
  1617.     move.l    a1,a0            ; Make a copy of buffer address
  1618.     move.b    #"$",(a1)+        ; Put $ for hexadecimal
  1619.     addq.l    #2,a3            ; Bump pointer to segment number
  1620.     bsr    PrePrintIntelWord    ; Print the segment number
  1621.     move.b    #":",(a1)+        ; Character in between seg and offset
  1622.     subq.l    #4,a3            ; Bump pointer back to offset
  1623.     bsr    PrePrintIntelWord    ; Print the offset number
  1624.     move.l    #10,d3            ; Length of string
  1625.     bra    PrintMSG        ; Print string
  1626.  
  1627. PrintEntryExported
  1628.     lea    EntryExportedMSG,a0    ; Get address of message        Print "Exported"
  1629.     move.l    EntryExportedMSGLen,d3    ; Get length of message
  1630.     bsr    PrintMSG        ; Print the message
  1631.     rts                ; Return
  1632.  
  1633.  
  1634. **----------------------------------------------
  1635. **
  1636. ** Print relocation tables
  1637. **
  1638. **----------------------------------------------
  1639.  
  1640. PrintRelocTabs                ;                    Print segment relocations
  1641.  
  1642.     move.l    #NULL,d0        ; Clear new signal                Test for CTRL_C
  1643.     move.l    d0,d1            ; Clear signal mask
  1644.     move.l    AbsExecBase,a6        ; Get exec.library base
  1645.     jsr    _LVOSetSignal(a6)    ; Get signals
  1646.     move.l    DosBase(a5),a6        ; Get dos.library base
  1647.     and.l    #SIGBREAKF_CTRL_C,d0    ; Test for CTRL_C
  1648.     bne    UserBreakHere        ; Jump if pressed
  1649.  
  1650.     lea    PrintRelocationMSG,a0    ; Get address of message          Print "Segment relocations"
  1651.     move.l    PrintRelocationMSGLen,d3; Get length of message
  1652.     bsr    PrintMSG        ; Print the message
  1653.     move.l    #1,d7            ; d7=segment counter              Initialize segment counter
  1654.     move.w    SegTableOffset(a4),d5    ; Get seg table offset              Get address of segment table
  1655.     rol.w    #8,d5            ; d5=Pointer in seg table
  1656.     move.w    SegTableEntryNum(a4),d6    ; Get seg table entries              Get number of entries in segment table
  1657.     rol.w    #8,d6            ; d6=Seg table entries (n)
  1658. SearchSegTab4Reloc            ;                      FOR n=1 to entries in segment table
  1659.  
  1660.     btst    #0,SegFlags+1(a4,d5.w)    ; Test bit 8 of segment flags            If this segment contains relocation data
  1661.     beq    NoRelocInThisSeg    ; Jump if no relocations
  1662.     lea    RelocForSegMSG,a0    ; Get address of message              Print "Relocations for segment "
  1663.     move.l    RelocForSegMSGLen,d3    ; Get length of message
  1664.     bsr    PrintMSG        ; Print the message
  1665.     move.w    d7,d0            ; Get temp copy of seg num              ,segment counter
  1666.     rol.w    #8,d0            ; Make intel word
  1667.     lea    StackEquation(a5),a3    ; Get temporary address
  1668.     move.w    d0,(a3)            ; Save number
  1669.     bsr    PrePrintSingleIntelWord    ; Prepare for printing
  1670.     bsr    PrintMSG        ; Print the number
  1671.     clr.l    d2            ; Clear d2 for later
  1672.     move.l    d2,d0            ; Clear d0 for later too
  1673.     move.b    ShiftCount(a4),d0    ; Get shift count                  Goto position of segment in file
  1674.     move.w    SegmentPos(a4,d5.w),d2    ; Get position of segment
  1675.     rol.w    #8,d2            ; Position bytes correctly
  1676.     lsl.l    d0,d2            ; Shift pos by sector size
  1677.     move.w    SegmentLen(a4,d5.w),d0    ; Get length of segment                  Move an extra segment length bytes
  1678.     rol.w    #8,d0            ; Position bytes correctly
  1679.     add.l    d0,d2            ; Add the length
  1680.     bsr    SeekTo            ; Goto that position
  1681.     bsr    ReadIntelWord        ; Get length of buffer                  Get intel word at that address (items in table)
  1682.     clr.l    d3            ; Clear d0                      Allocate items in table * 8 bytes of ram
  1683.     move.w    d2,d3            ; Get length of buffer
  1684.     move.l    d3,d4            ; d4=number of entries counter (x)
  1685.     lsl.l    #3,d3            ; Multiply by 8
  1686.     move.l    d3,d0            ; Save copy of length
  1687.     move.l    d3,RelocBufferLen(a5)    ; Save permanent copy of buffer len
  1688.     move.l    #AnyMemoryType,d1    ; Any memory type
  1689.     move.l    AbsExecBase,a6        ; Get address of exec base
  1690.     jsr    _LVOAllocMem(a6)    ; Allocate the memory
  1691.     move.l    DosBase(a5),a6        ; Get dos.library pointer
  1692.     tst.l    d0            ; Was memory allocated?
  1693.     bne    RelocBufferOK        ; Jump if OK
  1694.  
  1695.     lea    OutOfMemMSG,a0        ; Get address of message              If allocation UNsuccesful then
  1696.     move.l    OutOfMemMSGLen,d3    ; Get length of message                Print "Out of memory"
  1697.     bsr    PrintMSG        ; Print the message
  1698.     rts                ; Return                    rts
  1699.  
  1700. RelocBufferOK
  1701.     move.l    d0,a4            ; a4=address of reloc buffer              Read items in table * 8 bytes into allocates buffer
  1702.     move.l    d0,RelocBufferAddr(a5)    ; Keep permanent copy of buffer addr
  1703.     move.l    d0,d2            ; Get address of buffer
  1704.     move.l    aFileHandle(a5),d1    ; Get file handle
  1705.     jsr    _LVORead(a6)        ; Get relocation table
  1706.     cmp.l    d0,d3            ; Check return value                  If read failed then
  1707.     beq    RelocReadOK        ; Jump if ok
  1708.     lea    RelocReadFailedMSG,a0    ; Get address of message            Print "Read from file failed"
  1709.     move.l    RelocReadFailedMSGLen,d3; Get length of message
  1710.  
  1711. RelocError
  1712.     bsr    PrintMSG        ; Print the message
  1713.     move.l    HeaderAddress(a5),a4    ; Get address of header
  1714.     move.l    RelocBufferAddr(a5),a1    ; Get address of buffer
  1715.     move.l    RelocBufferLen(a5),d0    ; Get length of buffer
  1716.     move.l    AbsExecBase,a6        ; Get address of exec base
  1717.     jsr    _LVOFreeMem(a6)        ; Allocate the memory
  1718.     move.l    DosBase(a5),a6        ; Get dos.library pointer
  1719.     rts                ; Finished                    rts
  1720.  
  1721. RelocReadOK
  1722.     lea    TypeOffsTargetMSG,a0    ; Get address of message              Print "type    offset    target"
  1723.     move.l    TypeOffsTargetMSGLen,d3    ; Get length of message
  1724.     bsr    PrintMSG        ; Print the message
  1725.  
  1726. PrintRelocItem                ;                          FOR x = 1 to items in table
  1727.  
  1728.     move.l    #NULL,d0        ; Clear new signal                Test for CTRL_C
  1729.     move.l    d0,d1            ; Clear signal mask
  1730.     move.l    AbsExecBase,a6        ; Get exec base
  1731.     jsr    _LVOSetSignal(a6)    ; Get signals
  1732.     and.l    #SIGBREAKF_CTRL_C,d0    ; Test for CTRL_C
  1733.     bne    Escape            ; Jump if pressed
  1734.     move.l    DosBase(a5),a6        ; Get dos.library base
  1735.  
  1736.     lea    LoByteMSG,a0        ; Get address of message            If RelocAddrType = 0 then
  1737.     move.l    LoByteMSGLen,d3        ; Get length of message                  Print "LoByte "
  1738.     cmp.b    #0,RelocAddrType(a4)    ; Is it = 0?
  1739.     beq    RelocTypeFound        ; Print reloc type
  1740.     lea    SelectMSG,a0        ; Get address of message            If RelocAddrType = 2 then
  1741.     move.l    SelectMSGLen,d3        ; Get length of message                  Print "Select "
  1742.     cmp.b    #2,RelocAddrType(a4)    ; Is it = 2?
  1743.     beq    RelocTypeFound        ; Print reloc type
  1744.     lea    PtrMSG,a0        ; Get address of message            If RelocAddrType = 3 then
  1745.     move.l    PtrMSGLen,d3        ; Get length of message                  Print "PTR    "
  1746.     cmp.b    #3,RelocAddrType(a4)    ; Is it = 3?
  1747.     beq    RelocTypeFound        ; Print reloc type
  1748.     lea    OffsMSG,a0        ; Get address of message            If RelocAddrType = 5 then
  1749.     move.l    OffsMSGLen,d3        ; Get length of message                  Print "OFFS   "
  1750.     cmp.b    #5,RelocAddrType(a4)    ; Is it = 5?
  1751.     beq    RelocTypeFound        ; Print reloc type
  1752.     lea    Ptr48MSG,a0        ; Get address of message            If RelocAddrType = 11 then
  1753.     move.l    Ptr48MSGLen,d3        ; Get length of message                  Print "PTR-48 "
  1754.     cmp.b    #11,RelocAddrType(a4)    ; Is it = 11?
  1755.     beq    RelocTypeFound        ; Print reloc type
  1756.     lea    Offs32MSG,a0        ; Get address of message            If RelocAddrType = 13 then
  1757.     move.l    Offs32MSGLen,d3        ; Get length of message                  Print "OFFS-32 "
  1758.     cmp.b    #13,RelocAddrType(a4)    ; Is it = 13?
  1759.     beq    RelocTypeFound        ; Print reloc type
  1760.  
  1761.     lea    RelocTypeUnknMSG,a0    ; Get address of message            else print "Unknown relocation type. Send me this file to df114@city.ac.uk read docs!!!!"
  1762.     move.l    RelocTypeUnknMSGLen,d3    ; Get length of message
  1763.     bra    RelocError        ; Finish                      rts
  1764.  
  1765. RelocTypeFound
  1766.     bsr    PrintMSG        ; Print reloc type
  1767.     lea    RelocOffset(a4),a3    ; Get address of reloc offset            Print RelocOffset
  1768.     bsr    PrePrintSingleIntelWord    ; Prepare for printing
  1769.     subq.l    #1,d3            ; No newline
  1770.     bsr    PrintMSG        ; Print the number
  1771.     lea    SixBlankSpacesMSG,a0    ; Get address of message
  1772.     move.l    SixBlankSpacesMSGLen,d3    ; Get length of message
  1773.     bsr    PrintMSG        ; Print the message
  1774.  
  1775.     tst.b    RelocType(a4)        ; Is it 0                    If RelocType = 0 then        Internal reference
  1776.     beq    RelocInternalReference    ; Jump if true
  1777.     cmp.b    #1,RelocType(a4)    ; Is it 1                    If RelocType = 1 then        Imported ordinal
  1778.     beq    RelocImportedOrdinal    ; Jump if true
  1779.     cmp.b    #2,RelocType(a4)    ; Is it 2                    If RelocType = 2 then        Imported name
  1780.     beq    RelocImportedName    ; Jump if true
  1781.     cmp.b    #3,RelocType(a4)    ; Is it 3                    If RelocType = 3 then        OSFIXUP
  1782.     beq    RelocOSFIXUP        ; Jump if true
  1783.     cmp.b    #5,RelocType(a4)    ; Is it 5                    If RelocType = 5 then        Additive?
  1784.     beq    RelocAdditive        ; Jump if true
  1785.  
  1786.     lea    RelocTypeUnknMSG,a0    ; Get address of message            else
  1787.     move.l    RelocTypeUnknMSGEnd,d3    ; Get length of message                  Print "Unknown relocation type send me this file to df114@city.ac.uk read docs!!!!"
  1788.     bra    RelocError        ; Finish                      rts
  1789.  
  1790. RelocInternalReference            ;                        If RelocType = 0 then        Internal reference
  1791.     cmp.b    #$FF,RelocB4(a4)    ; Is segment movable?                  If RelocB4 = $FF then
  1792.     bne    RelocInternalFixed    ; Jump if fixed segment
  1793.     lea    EntryMSG,a0        ; Get address of message                Print "Entry "
  1794.     move.l    EntryMSGLen,d3        ; Get length of message
  1795.     bsr    PrintMSG        ; Print the message
  1796.     lea    RelocB6(a4),a3        ; Get pointer to entry                    ,RelocB6
  1797.     bsr    PrePrintSingleIntelWord    ; Print the number
  1798.     bra    RelocItemPrinted    ; Done
  1799. RelocInternalFixed
  1800.     move.l    RelocB4(a4),d0        ; Get number                      else
  1801.     swap    d0            ; Swap register halves                    Print RelocB4,":",RelocB6    Segment:Offset are the wrong way round
  1802.     rol.w    #8,d0            ; Position bytes correctly
  1803.     swap    d0            ; Swap register halves
  1804.     rol.w    #8,d0            ; Form number correctly
  1805.     bsr    PrintMotoRegNum        ; Print the number
  1806.     bra    RelocItemPrinted    ; Done
  1807.  
  1808. RelocImportedOrdinal            ;                        If RelocType = 1 then
  1809.     move.l    HeaderAddress(a5),a3    ; Get address of header
  1810.     clr.l    d0            ; Clear d0
  1811.     move.l    d0,d1            ; Clear d1
  1812.     move.b    RelocB4(a4),d0        ; Get RelocB4                      (RelocB4 - 1)*2
  1813.     subq.b    #1,d0            ; RelocB4-1
  1814.     lsl.w    #1,d0            ; (RelocB4-1)*2
  1815.     move.w    ModRefOffset(a3),d1    ; Get offset to mod-ref table              Add offset to mod-ref table
  1816.     rol.w    #8,d1            ; Position bytes correctly
  1817.     add.l    d0,d1            ; Add numbers
  1818.     move.w    (a3,d1),d1        ; Get offset into imp-nam table
  1819.     rol.w    #8,d1            ; Position bytes correctly
  1820.     move.w    ImpNameOffset(a3),d0    ; Get offset to imp-nam table              Add that word to offset of imp-name table
  1821.     rol.w    #8,d0            ; Position bytes correctly
  1822.     add.l    d0,d1            ; Add the numbers
  1823.     lea    (a3,d1),a0        ; Get address of string                  Print that byte many bytes at that addr+1
  1824.     move.b    (a0)+,d3        ; Get length of string
  1825.     bsr    PrintMSG        ; Print the string
  1826.     lea    FullStopMSG,a0        ; Get address of message              Print "."
  1827.     move.l    FullStopMSGLen,d3    ; Get length of message
  1828.     bsr    PrintMSG        ; Print the message
  1829.     lea    RelocB6(a4),a3        ; Get address of number                  ,RelocB6
  1830.     bsr    PrePrintSingleIntelWord    ; Prepare for printing
  1831.     bsr    PrintMSG        ; Print the number
  1832.     bra    RelocItemPrinted    ; Done
  1833.  
  1834. RelocImportedName            ;                        If RelocType = 2 then        ; Imported name
  1835.     move.l    HeaderAddress(a5),a3    ; Get address of header
  1836.     clr.l    d0            ; Clear d0
  1837.     move.l    d0,d1            ; Clear d1
  1838.     move.b    RelocB4(a4),d0        ; Get RelocB4                      (RelocB4 - 1)*2
  1839.     subq.b    #1,d0            ; RelocB4-1
  1840.     lsl.w    #1,d0            ; (RelocB4-1)*2
  1841.     move.w    ModRefOffset(a3),d1    ; Get offset to mod-ref table              Add offset to mod-ref table
  1842.     rol.w    #8,d1            ; Position bytes correctly
  1843.     add.l    d0,d1            ; Add numbers
  1844.     move.w    (a3,d1),d1        ; Get offset into imp-nam table
  1845.     rol.w    #8,d1            ; Position bytes correctly
  1846.     move.w    ImpNameOffset(a3),d0    ; Get offset to imp-nam table              Add that word to offset of imp-name table
  1847.     rol.w    #8,d0            ; Position bytes correctly
  1848.     add.l    d0,d1            ; Add the numbers
  1849.     lea    (a3,d1),a0        ; Get address of string                  Print that byte many bytes at that addr+1
  1850.     move.b    (a0)+,d3        ; Get length of string
  1851.     bsr    PrintMSG        ; Print the string
  1852.     lea    FullStopMSG,a0        ; Get address of message              Print "."
  1853.     move.l    FullStopMSGLen,d3    ; Get length of message
  1854.     bsr    PrintMSG        ; Print the message
  1855.     move.l    HeaderAddress(a5),a3    ; Get address of header
  1856.     clr.l    d0            ; Clear d0
  1857.     move.l    d0,d1            ; Clear d1
  1858.     move.b    RelocB6(a4),d0        ; Get RelocB6                      RelocB6 + offset to imp-name table
  1859.     move.w    ImpNameOffset(a3),d1    ; Get offset to imp-nam table
  1860.     rol.w    #8,d1            ; Position bytes correctly
  1861.     add.l    d0,d1            ; Add the numbers
  1862.     lea    (a3,d1),a0        ; Get address of string                  Print that byte many bytes at that addr+1
  1863.     move.b    (a0)+,d3        ; Get length of string
  1864.     bsr    PrintMSG        ; Print the string
  1865.     lea    NewLineMSG,a0        ; Get address of message
  1866.     move.l    NewLineMSG,d3        ; Get length of message
  1867.     bsr    PrintMSG        ; Print the message
  1868.     bra    RelocItemPrinted    ; Done
  1869.  
  1870. RelocOSFIXUP                ;                        If RelocType = 3 then        OSFIXUP
  1871.     lea    RelocTypeUnknMSG,a0    ; Get address of message              Print "OSFIXUP Send me this file to df114@city.ac.uk read docs!!!!"
  1872.     move.l    RelocTypeUnknMSGLen,d3    ; Get length of message
  1873.     bra    RelocError        ; Finished                      rts
  1874.  
  1875. RelocAdditive
  1876.     move.l    HeaderAddress(a5),a3    ; Get address of header
  1877.     clr.l    d0            ; Clear d0
  1878.     move.l    d0,d1            ; Clear d1
  1879.     move.b    RelocB4(a4),d0        ; Get RelocB4                      (RelocB4 - 1)*2
  1880.     subq.b    #1,d0            ; RelocB4-1
  1881.     lsl.w    #1,d0            ; (RelocB4-1)*2
  1882.     move.w    ModRefOffset(a3),d1    ; Get offset to mod-ref table              Add offset to mod-ref table
  1883.     rol.w    #8,d1            ; Position bytes correctly
  1884.     add.l    d0,d1            ; Add numbers
  1885.     move.w    (a3,d1),d1        ; Get offset into imp-nam table
  1886.     rol.w    #8,d1            ; Position bytes correctly
  1887.     move.w    ImpNameOffset(a3),d0    ; Get offset to imp-nam table              Add that word to offset of imp-name table
  1888.     rol.w    #8,d0            ; Position bytes correctly
  1889.     add.l    d0,d1            ; Add the numbers
  1890.     lea    (a3,d1),a0        ; Get address of string                  Print that byte many bytes at that addr+1
  1891.     move.b    (a0)+,d3        ; Get length of string
  1892.     bsr    PrintMSG        ; Print the string
  1893.     lea    FullStopMSG,a0        ; Get address of message              Print "."
  1894.     move.l    FullStopMSGLen,d3    ; Get length of message
  1895.     bsr    PrintMSG        ; Print the message
  1896.     lea    RelocB6(a4),a3        ; Get address of number                  ,RelocB6
  1897.     bsr    PrePrintSingleIntelWord    ; Prepare for printing
  1898.     bsr    PrintMSG        ; Print the number
  1899.  
  1900. RelocItemPrinted
  1901.     addq.l    #8,a4            ; Add 8                        Add 8 to pointer            ; Skip to next entry in relocation table
  1902.     subq.w    #1,d4            ; Decrement num of entries
  1903.     tst.w    d4
  1904.     bne    PrintRelocItem        ; Loop                        END ; FOR
  1905.  
  1906.     move.l    RelocBufferAddr(a5),a1    ; Get address of reloc buffer              Deallocate memory just used
  1907.     move.l    RelocBufferLen(a5),d0    ; Get length of reloc buffer
  1908.     move.l    AbsExecBase,a6        ; Get exec base
  1909.     jsr    _LVOFreeMem(a6)        ; Free the memory
  1910.     move.l    DosBase(a5),a6        ; Restore dos.library pointer
  1911.     move.l    HeaderAddress(a5),a4    ; Get address of header
  1912. NoRelocInThisSeg
  1913.     addq.w    #8,d5            ; Add 8 to pointer                  Add 8 to pointer'            ; Skip to next entry in segment table
  1914.     addq.w    #1,d7            ; Increment segment counter
  1915.     subq.w    #1,d6            ; Decrement number of segments
  1916.     tst.w    d6            ; Are we finished?
  1917.     bne    SearchSegTab4Reloc    ; Loop                          END ; FOR
  1918.     rts                ; Finished
  1919.  
  1920.  
  1921. Escape
  1922.     move.l    RelocBufferAddr(a5),a1    ; Get address of reloc buffer                Deallocate memory just used
  1923.     move.l    RelocBufferLen(a5),d0    ; Get length of reloc buffer
  1924.     jsr    _LVOFreeMem(a6)        ; Free the memory
  1925.     move.l    DosBase(a5),a6        ; Restore dos.library pointer
  1926.     move.l    HeaderAddress(a5),a4    ; Get address of header
  1927. UserBreakHere
  1928.     lea    UserBreakMSG,a0        ; Get address of message            Print user break message
  1929.     move.l    UserBreakMSGLen,d3    ; Get length of message
  1930.     bra    PrintMSG        ; Print the message                Quit
  1931.  
  1932.  
  1933. *++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1934. *++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1935. *++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1936. *++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1937.  
  1938. **+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1939. **
  1940. ** PrintByte        PrintByte(Number)
  1941. **                   d3
  1942. **
  1943. ** Print the byte held in d3
  1944. **
  1945. **+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1946.  
  1947. PrintByte
  1948.     lea    TempBuffer(a5),a0    ; Get address of temp buffer
  1949.     bsr    ConvertBin2ASCII    ; Convert number to ASCII
  1950.     move.b    #"$",(a0)        ; Put a $ sign
  1951.     move.b    d0,1(a0)        ; Put high nibble
  1952.     move.b    d1,2(a0)        ; Put low nibble
  1953.     move.l    #3,d3            ; Three characters to print
  1954.     bra    PrintMSG        ; Print the number
  1955.  
  1956.  
  1957. **+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1958. **
  1959. ** PrintMotoRegNum    PrintMotoRegNum(Number)
  1960. **                     d0
  1961. **
  1962. ** Prints the normal format number in d0 in segment:offset form
  1963. **
  1964. **+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1965.  
  1966. PrintMotoRegNum
  1967.     rol.w    #8,d0            ; Convert to intel form
  1968.     swap    d0            ; Swap register halves
  1969.     rol.w    #8,d0            ; Convert to intel form
  1970.     move.l    d0,StackEquation(a5)    ; Put number for printing
  1971.     lea    StackEquation(a5),a3    ; Get address of number
  1972.     bra    PrintSegOffset        ; Print the number
  1973.  
  1974.  
  1975. **+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1976. **
  1977. ** PrintSegOffset    PrintSegOffset(*Number)
  1978. **                    a3
  1979. **
  1980. ** Prints a segment and offset number as pointed to by a3
  1981. **
  1982. **+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1983.  
  1984. PrintSegOffset
  1985.     lea    TempBuffer(a5),a1    ; Get address of printing buffer
  1986.     move.l    a1,a0            ; Make a copy of buffer address
  1987.     move.b    #"$",(a1)+        ; Put $ for hexadecimal
  1988.     addq.l    #2,a3            ; Bump pointer to segment number
  1989.     bsr    PrePrintIntelWord    ; Print the segment number
  1990.     move.b    #":",(a1)+        ; Character in between seg and offset
  1991.     subq.l    #4,a3            ; Bump pointer back to offset
  1992.     bsr    PrePrintIntelWord    ; Print the offset number
  1993.     move.b    #NewLine,(a1)+        ; New line
  1994.     move.l    #11,d3            ; Length of string
  1995.     bra    PrintMSG        ; Print string
  1996.  
  1997.  
  1998.  
  1999.  
  2000. **+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2001. **
  2002. ** PrePrintIntelWord    PrePrintIntelWord(*Number,*PrintBuffer)
  2003. **                        a3        a1
  2004. **
  2005. ** Puts the ASCII codes for a word into a string ready to be printed. a3 points to the number and
  2006. ** a1 points to the number itself in Intel format.
  2007. **
  2008. **+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2009.  
  2010. PrePrintIntelWord
  2011.     move.b    1(a3),d3        ; Get high byte of number
  2012.     bsr    ConvertBin2ASCII    ; Get ASCII codes
  2013.     move.b    d0,(a1)+        ; Put high nibble
  2014.     move.b    d1,(a1)+        ; Put low nibble
  2015.     move.b    (a3),d3            ; Get low byte of number
  2016.     bsr    ConvertBin2ASCII    ; Get ASCII codes
  2017.     move.b    d0,(a1)+        ; Put high nibble
  2018.     move.b    d1,(a1)+        ; Put low nibble
  2019.     addq.l    #2,a3            ; Increment pointer past number
  2020.     rts                ; Return
  2021.  
  2022.  
  2023.  
  2024. **+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2025. **
  2026. ** PrePrintSingleIntelWord    *Buffer , Length = PrePrintSingleIntelWord(*Number)
  2027. **                  a0        d3                    a3
  2028. **
  2029. ** Prepares a single Intel format word for printing. It return a pointer to the print buffer and has
  2030. ** the length in d3 ready for a call to PrintMSG.
  2031. **
  2032. **+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2033.  
  2034. PrePrintSingleIntelWord
  2035.     lea    TempBuffer(a5),a1    ; Get address of temporary buffer
  2036.     move.l    a1,a0            ; Keep a temporary copy of buffer address
  2037.     move.b    #"$",(a1)+        ; Put $ for hex number
  2038.     bsr    PrePrintIntelWord    ; Put number
  2039.     move.b    #NewLine,(a1)+        ; Put new line character
  2040.     move.l    #6,d3            ; 6 characters to be printed
  2041.     rts                ; Finished
  2042.  
  2043. **+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2044. **
  2045. ** ReadIntelWord  d2 = ReadIntelWord
  2046. **
  2047. ** Read an Intel backward format word from current position in file and
  2048. ** returns it as a proper Motorola word
  2049. **
  2050. **+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2051.  
  2052. ReadIntelWord
  2053.     move.l    aFileHandle(a5),d1    ; Get file handle
  2054.     lea    TempBuffer(a5),a0    ; Get address of temp buffer
  2055.     move.l    a0,d2            ; Put temp buffer address in d2
  2056.     move.l    #2,d3            ; Two bytes or word to be checked
  2057.     jsr    _LVORead(a6)        ; Read word for checking
  2058.     cmp.l    #2,d0            ; Read OK?
  2059.     bne    ReadFailed        ; Goto read failed error
  2060.     move.w    TempBuffer(a5),d2    ; Get word
  2061.     rol.w    #8,d2            ; Swap high and low byte
  2062.     rts                ; Return word
  2063.  
  2064.  
  2065.  
  2066. **+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2067. **
  2068. ** SeekTo   SeekTo(Position)
  2069. **            d2
  2070. **
  2071. ** Seeks to the indicated position in the file. If operation unsuccesful
  2072. ** the return address is POPed from the stack and an error printed.
  2073. **
  2074. **+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2075.  
  2076. SeekTo
  2077.     move.l    aFileHandle(a5),d1    ; Move file handle to d1
  2078.     move.l    #OFFSET_BEGINNING,d3    ; Seek from beginning of file
  2079.     jsr    _LVOSeek(a6)        ; Seek
  2080.     cmp.l    #-1,d0            ; Was seek succesful?
  2081.     beq    SeekNotSuccesful    ; Goto error if unsuccesful   
  2082.     rts                ; Completed succesfully
  2083.  
  2084. **+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2085. **
  2086. ** ConvertBin2ASCII    d0,d1 = ConvertBin2ASCII (binary number)
  2087. **                            d3
  2088. **
  2089. ** Converts an 8-digit binary number to two ASCII hexadecimal digits.
  2090. **
  2091. ** d0 = high digit bits 4-7
  2092. ** d1 = low digit bits 0-3
  2093. **
  2094. **+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2095.  
  2096. ConvertBin2ASCII
  2097.     move.b    d3,d0            ; Get low nibble
  2098.     and.b    #$0F,d0            ; Blank out high nibble
  2099.     bsr    ConvertNumber        ; Convert the nibble
  2100.     move.b    d0,d1            ; Store low nibble in d1
  2101.     move.b    d3,d0            ; Get high nibble
  2102.     lsr.b    #4,d0            ; Position it correctly
  2103. ConvertNumber
  2104.     add.b    #$30,d0            ; Add ASCII "0"
  2105.     cmp.b    #$3A,d0            ; Is number < 10 ?
  2106.     blt    ConversionComplete    ; If yes then conversion complete
  2107.     add.b    #$07,d0            ; Add to ASCII "A"
  2108. ConversionComplete
  2109.     rts                ; Conversion completed
  2110.  
  2111.  
  2112. **+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2113. **
  2114. ** PrintMSG    PrintMSG (*MSG,Length)
  2115. **               a0    d3
  2116. **
  2117. ** Prints a given message to standard out.
  2118. **
  2119. **+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2120.  
  2121. PrintMSG
  2122.     move.l    DosBase(a5),a6        ; Get dos base address
  2123.     move.l    a0,d2            ; Put message pointer in d2
  2124.     move.l    OutputHandle(a5),d1    ; Move output handle to d1
  2125.     jsr    _LVOWrite(a6)        ; Print message
  2126.     rts                ; Print complete
  2127.  
  2128.  
  2129.  
  2130. **=====================================================================================================
  2131. **
  2132. ** Error handlers
  2133. **
  2134. **=====================================================================================================
  2135.  
  2136.  
  2137. FileNotOpenOK
  2138.     move.l    FileNotOpenMSGLen,d3    ; Get length of message
  2139.     lea    FileNotOpenMSG,a0    ; Get pointer to error message
  2140.     bra    PrintErrorAndReturnToDos; Print error message
  2141.  
  2142. MemoryNotAllocated
  2143.     move.l    MemoryNotAllocatedMSGLen,d3    ; Get length message
  2144.     lea    MemoryNotAllocatedMSG,a0    ; Get pointer to error message
  2145.     bra    CloseFileAndDosLibPrintMSG    ; Print error message
  2146.  
  2147. NotWindowsEXE
  2148.     move.l    NotWindowsEXEMSGLen,d3        ; Get length message
  2149.     lea    NotWindowsEXEMSG,a0        ; Get pointer to error message
  2150.     bra    CloseFileAndDosLibPrintMSG    ; Print error message
  2151.  
  2152. ReadFailed
  2153.     move.l    ReadFailedMSGLen,d3        ; Get length message
  2154.     lea    ReadFailedMSG,a0        ; Get pointer to error message
  2155.     addq.l    #4,sp                ; POP return address from stack
  2156.     bra    CloseFileAndDosLibPrintMSG    ; Print error message
  2157.  
  2158. SeekNotSuccesful
  2159.     move.l    SeekNotSuccesMSGLen,d3        ; Get length message
  2160.     lea    SeekNotSuccesMSG,a0        ; Get pointer to error message
  2161.     addq.l    #4,sp                ; POP return address from stack
  2162.     bra    CloseFileAndDosLibPrintMSG    ; Print error message
  2163.  
  2164.  
  2165. CloseFileAndDosLibPrintMSG
  2166.     move.l    a0,a3            ; Save message pointer
  2167.     move.l    aFileHandle(a5),d1    ; Get file handle
  2168.     move.l    DosBase(a5),a6        ; Get dos lib base address
  2169.     jsr    _LVOClose(a6)        ; Close file
  2170.     move.l    a3,a0            ; Get message pointer
  2171.  
  2172. PrintErrorAndReturnToDos
  2173.     bsr    PrintMSG        ; Print error message
  2174.  
  2175.     tst.l    UseStdIOFlag(a5)    ; Using stdio?
  2176.     bne    UsingStdIOAlso        ; Jump if yes
  2177.  
  2178.     move.l    #SIGBREAKF_CTRL_C,d0    ; Test CTRL C                Test for CTRL_C
  2179.     move.l    AbsExecBase,a6        ; Get exec.library base
  2180.     jsr    _LVOWait(a6)        ; Wait signal
  2181.     move.l    DosBase(a5),a6        ; Get dos.library base
  2182.     move.l    OutputHandle(a5),d1    ; Get handle for output            Close our own output channel
  2183.     jsr    _LVOClose(a6)        ; Close it
  2184.  
  2185. UsingStdIOAlso
  2186.     move.l    a6,a1            ; Pointer to dos.library        Close dos.library
  2187.     move.l    AbsExecBase,a6        ; Get exec base address
  2188.     jsr    _LVOCloseLibrary(a6)    ; Close dos.library
  2189.  
  2190.     move.l    a5,a1            ; Free temporary storage memory        Deallocate temp buffer
  2191.     move.l    TempBufferLen(a5),d0    ; Get length of temporary buffer
  2192.     jsr    _LVOFreeMem(a6)        ; Free the memory
  2193.  
  2194.     moveq.l    #0,d0            ; Return code = 0
  2195.  
  2196.     rts                ; Return to DOS
  2197.  
  2198.  
  2199. DosNotOpen
  2200.     move.l    a5,a1            ; Free temporary storage memory
  2201.     move.l    TempBufferLen(a5),d0    ; Get size of memory block
  2202.     jsr    _LVOFreeMem(a6)        ; Free the memory
  2203.  
  2204.     move.l    #20,d0            ; Error code = 20 not open
  2205.     rts                ; Exit
  2206.  
  2207.  
  2208. TempBufNoAlloc
  2209.     move.l    #30,d0            ; Error code = 30 buffer not allocated
  2210.     rts                ; Exit
  2211.  
  2212.  
  2213.  
  2214.  
  2215. **=====================================================================================================
  2216. **
  2217. **    The wonderful data section
  2218. **
  2219. **=====================================================================================================
  2220.  
  2221.  
  2222.         SECTION    data,DATA
  2223.  
  2224.  
  2225. DosLibName
  2226.     dc.b    "dos.library",NULL
  2227. FileName
  2228.     dc.b    "TaskMan.exe",NULL
  2229.  
  2230.  
  2231.  
  2232. ** Error messages
  2233.  
  2234. FileNotOpenMSGLen
  2235.     dc.l    FileNotOpenMSGEnd-FileNotOpenMSG
  2236. FinishMSGLen
  2237.     dc.l    FinishMSGEnd-FinishMSG
  2238. MemoryNotAllocatedMSGLen
  2239.     dc.l    MemoryNotAllocatedMSGEnd-MemoryNotAllocatedMSG
  2240. NotWindowsEXEMSGLen
  2241.     dc.l    NotWindowsEXEMSGEnd-NotWindowsEXEMSG
  2242. ReadFailedMSGLen
  2243.     dc.l    ReadFailedMSGEnd-ReadFailedMSG
  2244. SeekNotSuccesMSGLen
  2245.     dc.l    SeekNotSuccesMSGEnd-SeekNotSuccesMSG
  2246.  
  2247. FileNotOpenMSG
  2248.     dc.b    "File did not open succesfully.",NewLine
  2249. FileNotOpenMSGEnd
  2250. FinishMSG
  2251.     dc.b    NewLine,"Program completed succesfully.",NewLine
  2252. FinishMSGEnd
  2253. MemoryNotAllocatedMSG
  2254.     dc.b    "Memory not allocated, not enough memory perhaps?",NewLine,NULL
  2255. MemoryNotAllocatedMSGEnd
  2256. NotWindowsEXEMSG
  2257.     dc.b    "This is not a windows NE file.",NewLine
  2258. NotWindowsEXEMSGEnd
  2259. ReadFailedMSG
  2260.     dc.b    "Read operation failed.",NewLine
  2261. ReadFailedMSGEnd
  2262. SeekNotSuccesMSG
  2263.     dc.b    "Seek operation unsuccesful",NewLine
  2264. SeekNotSuccesMSGEnd
  2265.  
  2266.  
  2267.  
  2268.  
  2269. ** Data printing messages
  2270.  
  2271. AccessTypeMSGLen
  2272.     dc.l    AccessTypeMSGEnd-AccessTypeMSG
  2273. AutoDataSegMSGLen
  2274.     dc.l    AutoDataSegMSGEnd-AutoDataSegMSG
  2275. CodeMSGLen
  2276.     dc.l    CodeMSGEnd-CodeMSG
  2277. DataMSGLen
  2278.     dc.l    DataMSGEnd-DataMSG
  2279. EntryMSGLen
  2280.     dc.l    EntryMSGEnd-EntryMSG
  2281. EntryConstantMSGLen
  2282.     dc.l    EntryConstantMSGEnd-EntryConstantMSG
  2283. EntryEntriesMSGLen
  2284.     dc.l    EntryEntriesMSGEnd-EntryEntriesMSG
  2285. EntryEntriesSegMSGLen
  2286.     dc.l    EntryEntriesSegMSGEnd-EntryEntriesSegMSG
  2287. EntryExportedMSGLen
  2288.     dc.l    EntryExportedMSGEnd-EntryExportedMSG
  2289. EntryFixOffsetMSGLen
  2290.     dc.l    EntryFixOffsetMSGEnd-EntryFixOffsetMSG
  2291. EntryFixSegRecrMSGLen
  2292.     dc.l    EntryFixSegRecrMSGEnd-EntryFixSegRecrMSG
  2293. EntryMoveOffsetMSGLen
  2294.     dc.l    EntryMoveOffsetMSGEnd-EntryMoveOffsetMSG
  2295. EntryMoveRecrMSGLen
  2296.     dc.l    EntryMoveRecrMSGEnd-EntryMoveRecrMSG
  2297. EntryMoveSegMSGLen
  2298.     dc.l    EntryMoveSegMSGEnd-EntryMoveSegMSG
  2299. EntryNullEntriesMSGLen
  2300.     dc.l    EntryNullEntriesMSGEnd-EntryNullEntriesMSG
  2301. EntryNumberMSGLen
  2302.     dc.l    EntryNumberMSGEnd-EntryNumberMSG
  2303. EntryTableMSGLen
  2304.     dc.l    EntryTableMSGEnd-EntryTableMSG
  2305. ExecutableTypeMSGLen
  2306.     dc.l    ExecutableTypeMSGEnd-ExecutableTypeMSG
  2307. ExecuteOnlyMSGLen
  2308.     dc.l    ExecuteOnlyMSGEnd-ExecuteOnlyMSG
  2309. FileDataModelMSGLen
  2310.     dc.l    FileDataModelMSGEnd-FileDataModelMSG
  2311. FileSegLengthMSGLen
  2312.     dc.l    FileSegLengthMSGEnd-FileSegLengthMSG
  2313. FixedMSGLen
  2314.     dc.l    FixedMSGEnd-FixedMSG
  2315. FullStopMSGLen
  2316.     dc.l    FullStopMSGEnd-FullStopMSG
  2317. GlobalMSGLen
  2318.     dc.l    GlobalMSGEnd-GlobalMSG
  2319. InitCSIPMSGLen
  2320.     dc.l    InitCSIPMSGEnd-InitCSIPMSG
  2321. InitLocalHeapMSGLen
  2322.     dc.l    InitLocalHeapMSGEnd-InitLocalHeapMSG
  2323. InitStackSizeMSGLen
  2324.     dc.l    InitStackSizeMSGEnd-InitStackSizeMSG
  2325. IsSelfLoadingMSGLen
  2326.     dc.l    IsSelfLoadingMSGEnd-IsSelfLoadingMSG
  2327. LibraryModuleMSGLen
  2328.     dc.l    LibraryModuleMSGEnd-LibraryModuleMSG
  2329. LoaderAllocMSGLen
  2330.     dc.l    LoaderAllocMSGEnd-LoaderAllocMSG
  2331. LoadOnCallMSGLen
  2332.     dc.l    LoadOnCallMSGEnd-LoadOnCallMSG
  2333. LoByteMSGLen
  2334.     dc.l    LoByteMSGEnd-LoByteMSG
  2335. MinAllocForSegMSGLen
  2336.     dc.l    MinAllocForSegMSGEnd-MinAllocForSegMSG
  2337. ModTableEntriesMSGLen
  2338.     dc.l    ModTableEntriesMSGEnd-ModTableEntriesMSG
  2339. ModuleDescribeMSGLen
  2340.     dc.l    ModuleDescribeMSGEnd-ModuleDescribeMSG
  2341. ModuleNameMSGLen
  2342.     dc.l    ModuleNameMSGEnd-ModuleNameMSG
  2343. MoveableMSGLen
  2344.     dc.l    MoveableMSGEnd-MoveableMSG
  2345. MultipleDataModelMSGLen
  2346.     dc.l    MultipleDataModelMSGEnd-MultipleDataModelMSG
  2347. NewLineMSGLen
  2348.     dc.l    NewLineMSGEnd-NewLineMSG
  2349. NoMSGLen
  2350.     dc.l    NoMSGEnd-NoMSG
  2351. NoAutoDataModelMSGLen
  2352.     dc.l    NoAutoDataModelMSGEnd-NoAutoDataModelMSG
  2353. NoDataInSegmentMSGLen
  2354.     dc.l    NoDataInSegmentMSGEnd-NoDataInSegmentMSG
  2355. NoLocalHeapMSGLen
  2356.     dc.l    NoLocalHeapMSGEnd-NoLocalHeapMSG
  2357. NonResNamTableMSGLen
  2358.     dc.l    NonResNamTableMSGEnd-NonResNamTableMSG
  2359. NonShareMSGLen
  2360.     dc.l    NonShareMSGEnd-NonShareMSG
  2361. NormalExecutableMSGLen
  2362.     dc.l    NormalExecutableMSGEnd-NormalExecutableMSG
  2363. OffsMSGLen
  2364.     dc.l    OffsMSGEnd-OffsMSG
  2365. Offs32MSGLen
  2366.     dc.l    Offs32MSGEnd-Offs32MSG
  2367. OutOfMemMSGLen
  2368.     dc.l    OutOfMemMSGEnd-OutOfMemMSG
  2369. PreLoadMSGLen
  2370.     dc.l    PreLoadMSGEnd-PreLoadMSG
  2371. PrintRelocationMSGLen
  2372.     dc.l    PrintRelocationMSGEnd-PrintRelocationMSG
  2373. PtrMSGLen
  2374.     dc.l    PtrMSGEnd-PtrMSG
  2375. Ptr48MSGLen
  2376.     dc.l    Ptr48MSGEnd-Ptr48MSG
  2377. ReadOnlyMSGLen
  2378.     dc.l    ReadOnlyMSGEnd-ReadOnlyMSG
  2379. RelocForSegMSGLen
  2380.     dc.l    RelocForSegMSGEnd-RelocForSegMSG
  2381. RelocReadFailedMSGLen
  2382.     dc.l    RelocReadFailedMSGEnd-RelocReadFailedMSG
  2383. RelocTypeUnknMSGLen
  2384.     dc.l    RelocTypeUnknMSGEnd-RelocTypeUnknMSG
  2385. ResNamTableMSGLen
  2386.     dc.l    ResNamTableMSGEnd-ResNamTableMSG
  2387. ResourceTypeMSGLen
  2388.     dc.l    ResourceTypeMSGEnd-ResourceTypeMSG
  2389. RevisionNumMSGLen
  2390.     dc.l    RevisionNumMSGEnd-RevisionNumMSG
  2391. rnFlagsMSGLen
  2392.     dc.l    rnFlagsMSGEnd-rnFlagsMSG
  2393. rnFlagsMoveableMSGLen
  2394.     dc.l    rnFlagsMoveableMSGEnd-rnFlagsMoveableMSG
  2395. rnFlagsPreloadMSGLen
  2396.     dc.l    rnFlagsPreloadMSGEnd-rnFlagsPreloadMSG
  2397. rnFlagsPureMSGLen
  2398.     dc.l    rnFlagsPureMSGEnd-rnFlagsPureMSG
  2399. rnIDMSGLen
  2400.     dc.l    rnIDMSGEnd-rnIDMSG
  2401. rnOffsetMSGLen
  2402.     dc.l    rnOffsetMSGEnd-rnOffsetMSG
  2403. rnLengthMSGLen
  2404.     dc.l    rnLengthMSGEnd-rnLengthMSG
  2405. rscAlignShiftMSGLen
  2406.     dc.l    rscAlignShiftMSGEnd-rscAlignShiftMSG
  2407. RscTableOffsetMSGLen
  2408.     dc.l    RscTableOffsetMSGEnd-RscTableOffsetMSG
  2409. RT_AcceleratorMSGLen
  2410.     dc.l    RT_AcceleratorMSGEnd-RT_AcceleratorMSG
  2411. RT_BitmapMSGLen
  2412.     dc.l    RT_BitmapMSGEnd-RT_BitmapMSG
  2413. RT_CursorMSGLen
  2414.     dc.l    RT_CursorMSGEnd-RT_CursorMSG
  2415. RT_DialogMSGLen
  2416.     dc.l    RT_DialogMSGEnd-RT_DialogMSG
  2417. RT_FontMSGLen
  2418.     dc.l    RT_FontMSGEnd-RT_FontMSG
  2419. RT_FontDirMSGLen
  2420.     dc.l    RT_FontDirMSGEnd-RT_FontDirMSG
  2421. RT_Group_CursorMSGLen
  2422.     dc.l    RT_Group_CursorMSGEnd-RT_Group_CursorMSG
  2423. RT_Group_IconMSGLen
  2424.     dc.l    RT_Group_IconMSGEnd-RT_Group_IconMSG
  2425. RT_IconMSGLen
  2426.     dc.l    RT_IconMSGEnd-RT_IconMSG
  2427. RT_MenuMSGLen
  2428.     dc.l    RT_MenuMSGEnd-RT_MenuMSG
  2429. RT_RCDataMSGLen
  2430.     dc.l    RT_RCDataMSGEnd-RT_RCDataMSG
  2431. RT_StringMSGLen
  2432.     dc.l    RT_StringMSGEnd-RT_StringMSG
  2433. RT_UnkRscTypeMSGLen
  2434.     dc.l    RT_UnkRscTypeMSGEnd-RT_UnkRscTypeMSG
  2435. RT_VersionInfoMSGLen
  2436.     dc.l    RT_VersionInfoMSGEnd-RT_VersionInfoMSG
  2437. rtResourceCountMSGLen
  2438.     dc.l    rtResourceCountMSGEnd-rtResourceCountMSG
  2439. SegDiscardMSGLen
  2440.     dc.l    SegDiscardMSGEnd-SegDiscardMSG
  2441. SegmentLoadedMSGLen
  2442.     dc.l    SegmentLoadedMSGEnd-SegmentLoadedMSG
  2443. SegmentLoadTypeMSGLen
  2444.     dc.l    SegmentLoadTypeMSGEnd-SegmentLoadTypeMSG
  2445. SegmentNumberMSGLen
  2446.     dc.l    SegmentNumberMSGEnd-SegmentNumberMSG
  2447. SegmentTypeMSGLen
  2448.     dc.l    SegmentTypeMSGEnd-SegmentTypeMSG
  2449. SegmentRelocMSGLen
  2450.     dc.l    SegmentRelocMSGEnd-SegmentRelocMSG
  2451. SegmentSharingMSGLen
  2452.     dc.l    SegmentSharingMSGEnd-SegmentSharingMSG
  2453. SegRelocationMSGLen
  2454.     dc.l    SegRelocationMSGEnd-SegRelocationMSG
  2455. SegTableEntryNumMSGLen
  2456.     dc.l    SegTableEntryNumMSGEnd-SegTableEntryNumMSG
  2457. SegTableOffsetMSGLen
  2458.     dc.l    SegTableOffsetMSGEnd-SegTableOffsetMSG
  2459. SelectMSGLen
  2460.     dc.l    SelectMSGEnd-SelectMSG
  2461. ShareMSGLen
  2462.     dc.l    ShareMSGEnd-ShareMSG
  2463. SingleDataModelMSGLen
  2464.     dc.l    SingleDataModelMSGEnd-SingleDataModelMSG
  2465. SixBlankSpacesMSGLen
  2466.     dc.l    SixBlankSpacesMSGEnd-SixBlankSpacesMSG
  2467. SixtyFourKMSGLen
  2468.     dc.l    SixtyFourKMSGEnd-SixtyFourKMSG
  2469. StackAddressMSGLen
  2470.     dc.l    StackAddressMSGEnd-StackAddressMSG
  2471. TypeOffsTargetMSGLen
  2472.     dc.l    TypeOffsTargetMSGEnd-TypeOffsTargetMSG
  2473. UserBreakMSGLen
  2474.     dc.l    UserBreakMSGEnd-UserBreakMSG
  2475. VersionNumMSGLen
  2476.     dc.l    VersionNumMSGEnd-VersionNumMSG
  2477. YesMSGLen
  2478.     dc.l    YesMSGEnd-YesMSG
  2479. TemplateLen
  2480.     dc.l    TemplateEnd-Template
  2481.  
  2482. AccessTypeMSG
  2483.     dc.b    "  Access type                       :    "
  2484. AccessTypeMSGEnd
  2485. AutoDataSegMSG
  2486.     dc.b    "Automatic data segment number     :    "
  2487. AutoDataSegMSGEnd
  2488. CodeMSG
  2489.     dc.b    "      CODE"
  2490. CodeMSGEnd
  2491. DataMSG
  2492.     dc.b    "      DATA"
  2493. DataMSGEnd
  2494. EntryMSG
  2495.     dc.b    "Entry "
  2496. EntryMSGEnd
  2497. EntryConstantMSG
  2498.     dc.b    NewLine,"Constant bundle  :  "
  2499. EntryConstantMSGEnd
  2500. EntryEntriesMSG
  2501.     dc.b    " entries.",NewLine
  2502. EntryEntriesMSGEnd
  2503. EntryEntriesSegMSG
  2504.     dc.b    " entries.   Segment : "
  2505. EntryEntriesSegMSGEnd
  2506. EntryExportedMSG
  2507.     dc.b    "    Exported    "
  2508. EntryExportedMSGEnd
  2509. EntryFixOffsetMSG
  2510.     dc.b    "   Offset : "
  2511. EntryFixOffsetMSGEnd
  2512. EntryFixSegRecrMSG
  2513.     dc.b    NewLine,"Fixed segment records : "
  2514. EntryFixSegRecrMSGEnd
  2515. EntryMoveOffsetMSG
  2516.     dc.b    "   Offset : "
  2517. EntryMoveOffsetMSGEnd
  2518. EntryMoveRecrMSG
  2519.     dc.b    NewLine,"Movable segment records : "
  2520. EntryMoveRecrMSGEnd
  2521. EntryMoveSegMSG
  2522.     dc.b    "   Segment : "
  2523. EntryMoveSegMSGEnd
  2524. EntryNullEntriesMSG
  2525.     dc.b    NewLine,"Null entries : "
  2526. EntryNullEntriesMSGEnd
  2527. EntryNumberMSG
  2528.     dc.b    NewLine,"    Entry "
  2529. EntryNumberMSGEnd
  2530. EntryTableMSG
  2531.     dc.b    NewLine,"Entry table  : ",NewLine
  2532. EntryTableMSGEnd
  2533. ExecutableTypeMSG
  2534.     dc.b    "Executable type                   :    "
  2535. ExecutableTypeMSGEnd
  2536. ExecuteOnlyMSG
  2537.     dc.b    "      EXECUTEONLY"
  2538. ExecuteOnlyMSGEnd
  2539. FileDataModelMSG
  2540.     dc.b    "Data model type                   :    "
  2541. FileDataModelMSGEnd
  2542. FileSegLengthMSG
  2543.     dc.b    "  Segment length in file            :    "
  2544. FileSegLengthMSGEnd
  2545. FixedMSG
  2546.     dc.b    "      FIXED"
  2547. FixedMSGEnd
  2548. FullStopMSG
  2549.     dc.b    "."
  2550. FullStopMSGEnd
  2551. GlobalMSG
  2552.     dc.b    "GLOBAL",NewLine
  2553. GlobalMSGEnd
  2554. InitCSIPMSG
  2555.     dc.b    "Initial CS:IP                     :    "
  2556. InitCSIPMSGEnd
  2557. InitLocalHeapMSG
  2558.     dc.b    "Initial local heap size           :    "
  2559. InitLocalHeapMSGEnd
  2560. InitStackSizeMSG
  2561.     dc.b    "Initial stack size                :    "
  2562. InitStackSizeMSGEnd
  2563. IsSelfLoadingMSG
  2564.     dc.b    "Self loading application?         :    "
  2565. IsSelfLoadingMSGEnd
  2566. LibraryModuleMSG
  2567.     dc.b    "Library module",NewLine
  2568. LibraryModuleMSGEnd
  2569. LoaderAllocMSG
  2570.     dc.b    "Loader allocates memory for segment.",NewLine
  2571. LoaderAllocMSGEnd
  2572. LoadOnCallMSG
  2573.     dc.b    "      LOADONCALL"
  2574. LoadOnCallMSGEnd
  2575. LoByteMSG
  2576.     dc.b    "    LoByte  "
  2577. LoByteMSGEnd
  2578. MinAllocForSegMSG
  2579.     dc.b    "  Minimum allocation for segment    :    "
  2580. MinAllocForSegMSGEnd
  2581. ModuleDescribeMSG
  2582.     dc.b    NewLine,"Module description                :    "
  2583. ModuleDescribeMSGEnd
  2584. ModuleNameMSG
  2585.     dc.b    NewLine,"Module name                       :    "
  2586. ModuleNameMSGEnd
  2587. ModTableEntriesMSG
  2588.     dc.b    "Entries in module reference table :    "
  2589. ModTableEntriesMSGEnd
  2590. MoveableMSG
  2591.     dc.b    "      MOVEABLE"
  2592. MoveableMSGEnd
  2593. MultipleDataModelMSG
  2594.     dc.b    "MULTIPLEDATA",NewLine
  2595. MultipleDataModelMSGEnd
  2596. NewLineMSG
  2597.     dc.b    NewLine
  2598. NewLineMSGEnd
  2599. NoMSG
  2600.     dc.b    "NO",NewLine
  2601. NoMSGEnd
  2602. NoAutoDataModelMSG
  2603.     dc.b    "NOAUTODATA",NewLine
  2604. NoAutoDataModelMSGEnd
  2605. NoDataInSegmentMSG
  2606.     dc.b    "No data provided for this segment.",NewLine
  2607. NoDataInSegmentMSGEnd
  2608. NoLocalHeapMSG
  2609.     dc.b    "No initial allocation",NewLine
  2610. NoLocalHeapMSGEnd
  2611. NonResNamTableMSG
  2612.     dc.b    NewLine,"  Non-resident name table :",NewLine
  2613. NonResNamTableMSGEnd
  2614. NonShareMSG
  2615.     dc.b    "      IMPURE"
  2616. NonShareMSGEnd
  2617. NormalExecutableMSG
  2618.     dc.b    "Normal executable",NewLine
  2619. NormalExecutableMSGEnd
  2620. OffsMSG
  2621.     dc.b    "    Offs    "
  2622. OffsMSGEnd
  2623. Offs32MSG
  2624.     dc.b    "    Offs-32 "
  2625. Offs32MSGEnd
  2626. OutOfMemMSG
  2627.     dc.b    NewLine,"Out of memory.",NewLine
  2628. OutOfMemMSGEnd
  2629. PreLoadMSG
  2630.     dc.b    "      PRELOAD"
  2631. PreLoadMSGEnd
  2632. PrintRelocationMSG
  2633.     dc.b    NewLine,NewLine,"Segment relocations",NewLine
  2634. PrintRelocationMSGEnd
  2635. PtrMSG
  2636.     dc.b    "    PTR     "
  2637. PtrMSGEnd
  2638. Ptr48MSG
  2639.     dc.b    "    PTR-48  "
  2640. Ptr48MSGEnd
  2641. ReadOnlyMSG
  2642.     dc.b    "      READONLY"
  2643. ReadOnlyMSGEnd
  2644. RelocForSegMSG
  2645.     dc.b    "  Relocations for segment : "
  2646. RelocForSegMSGEnd
  2647. RelocReadFailedMSG
  2648.     dc.b    "Read from file failed!"
  2649. RelocReadFailedMSGEnd
  2650. RelocTypeUnknMSG
  2651.     dc.b    "Unknown relocation type. Send me this file to df114@city.ac.uk read docs!!!!"
  2652. RelocTypeUnknMSGEnd
  2653. ResNamTableMSG
  2654.     dc.b    NewLine,"  Resident-name table :",NewLine
  2655. ResNamTableMSGEnd
  2656. ResourceTypeMSG
  2657.     dc.b    NewLine,NewLine,NewLine,"  Resource type                     :    "
  2658. ResourceTypeMSGEnd
  2659. RevisionNumMSG
  2660.     dc.b    "Linker revision number            :    "
  2661. RevisionNumMSGEnd
  2662. rnFlagsMSG
  2663.     dc.b    "    Resource attributes",NewLine
  2664. rnFlagsMSGEnd
  2665. rnFlagsMoveableMSG
  2666.     dc.b    "       MOVEABLE"
  2667. rnFlagsMoveableMSGEnd
  2668. rnFlagsPreloadMSG
  2669.     dc.b    "       PRELOAD "
  2670. rnFlagsPreloadMSGEnd
  2671. rnFlagsPureMSG
  2672.     dc.b    "       PURE"
  2673. rnFlagsPureMSGEnd
  2674. rnIDMSG
  2675.     dc.b    NewLine,"    Resource ID                           :    "
  2676. rnIDMSGEnd
  2677. rnLengthMSG
  2678.     dc.b    "    Resource length                       :    "
  2679. rnLengthMSGEnd
  2680. rnOffsetMSG
  2681.     dc.b    NewLine,"    Resource offset                       :    "
  2682. rnOffsetMSGEnd
  2683. rscAlignShiftMSG
  2684.     dc.b    "Resource align shift              :    "
  2685. rscAlignShiftMSGEnd
  2686. RscTableOffsetMSG
  2687.     dc.b    NewLine,"Offset to resource table          :    "
  2688. RscTableOffsetMSGEnd
  2689. RT_AcceleratorMSG
  2690.     dc.b    "RT_ACCELERATOR",NewLine
  2691. RT_AcceleratorMSGEnd
  2692. RT_BitmapMSG
  2693.     dc.b    "RT_BITMAP",NewLine
  2694. RT_BitmapMSGEnd
  2695. RT_CursorMSG
  2696.     dc.b    "RT_CURSOR",NewLine
  2697. RT_CursorMSGEnd
  2698. RT_DialogMSG
  2699.     dc.b    "RT_DIALOG",NewLine
  2700. RT_DialogMSGEnd
  2701. RT_FontMSG
  2702.     dc.b    "RT_FONT",NewLine
  2703. RT_FontMSGEnd
  2704. RT_FontDirMSG
  2705.     dc.b    "RT_FONTDIR",NewLine
  2706. RT_FontDirMSGEnd
  2707. RT_Group_CursorMSG
  2708.     dc.b    "RT_GROUP_CURSOR",NewLine
  2709. RT_Group_CursorMSGEnd
  2710. RT_Group_IconMSG
  2711.     dc.b    "RT_GROUP_ICON",NewLine
  2712. RT_Group_IconMSGEnd
  2713. RT_IconMSG
  2714.     dc.b    "RT_ICON",NewLine
  2715. RT_IconMSGEnd
  2716. RT_MenuMSG
  2717.     dc.b    "RT_MENU",NewLine
  2718. RT_MenuMSGEnd
  2719. RT_RCDataMSG
  2720.     dc.b    "RT_RCDATA",NewLine
  2721. RT_RCDataMSGEnd
  2722. RT_StringMSG
  2723.     dc.b    "RT_STRING",NewLine
  2724. RT_StringMSGEnd
  2725. RT_UnkRscTypeMSG
  2726.     dc.b    "Unknown resource type "
  2727. RT_UnkRscTypeMSGEnd
  2728. RT_VersionInfoMSG
  2729.     dc.b    "Version info?",NewLine
  2730. RT_VersionInfoMSGEnd
  2731. rtResourceCountMSG
  2732.     dc.b    "  Resource count                    :    "
  2733. rtResourceCountMSGEnd
  2734. SegDiscardMSG
  2735.     dc.b    "      DISCARDABLE"
  2736. SegDiscardMSGEnd
  2737. SegmentLoadedMSG
  2738.     dc.b    "Segment is loaded at load time."
  2739. SegmentLoadedMSGEnd
  2740. SegmentLoadTypeMSG
  2741.     dc.b    "  Segment loaded type               :    "
  2742. SegmentLoadTypeMSGEnd
  2743. SegmentNumberMSG
  2744.     dc.b    NewLine,NewLine,"Data for segment number : "
  2745. SegmentNumberMSGEnd
  2746. SegmentRelocMSG
  2747.     dc.b    "  Segment relocation                :    "
  2748. SegmentRelocMSGEnd
  2749. SegmentSharingMSG
  2750.     dc.b    "  Segment sharing                   :    "
  2751. SegmentSharingMSGEnd
  2752. SegmentTypeMSG
  2753.     dc.b    "  Segment flags:",NewLine
  2754. SegmentTypeMSGEnd
  2755. SegRelocationMSG
  2756.     dc.b    "      RELOCATIONS"
  2757. SegRelocationMSGEnd
  2758. SegTableEntryNumMSG
  2759.     dc.b    "Entries in segment table          :    "
  2760. SegTableEntryNumMSGEnd
  2761. SegTableOffsetMSG
  2762.     dc.b    "Offset to segment table           :    "
  2763. SegTableOffsetMSGEnd
  2764. SelectMSG
  2765.     dc.b    "    Select  "
  2766. SelectMSGEnd
  2767. ShareMSG
  2768.     dc.b    "      PURE"
  2769. ShareMSGEnd
  2770. SingleDataModelMSG
  2771.     dc.b    "SINGLEDATA",NewLine
  2772. SingleDataModelMSGEnd
  2773. SixBlankSpacesMSG
  2774.     dc.b    "      "
  2775. SixBlankSpacesMSGEnd
  2776. SixtyFourKMSG
  2777.     dc.b    "64k",NewLine
  2778. SixtyFourKMSGEnd
  2779. StackAddressMSG
  2780.     dc.b    "Initial SS:SP                     :    "
  2781. StackAddressMSGEnd
  2782. TypeOffsTargetMSG
  2783.     dc.b    "    type    offset     target",NewLine
  2784. TypeOffsTargetMSGEnd
  2785. UserBreakMSG
  2786.     dc.b    NewLine,NewLine,"User break!",NewLine,NewLine
  2787. UserBreakMSGEnd
  2788. VersionNumMSG
  2789.     dc.b    NewLine,"Linker version number             :    "
  2790. VersionNumMSGEnd
  2791. YesMSG
  2792.     dc.b    "YES",NewLine
  2793. YesMSGEnd
  2794.  
  2795. Template
  2796.     dc.b    "Name/A,STDIO/S"
  2797. TemplateEnd
  2798.     dc.b    NULL        ; do *NOT* remove! Part of template
  2799.  
  2800. OutputString
  2801.     dc.b    "CON:0/10/640/100/Soyeb is the best",0
  2802.  
  2803.     END
  2804.